refactor(frontend): the module stores mount from the registry, and the feed and Plex each own their saved views
A module's definition names its store (feed: filters, view, saved views; Plex: browse state, saved views; channels, files, playlists their provider), and ModuleStores mounts them at the root in registry order instead of a hand-nested tree in main.tsx. A contract test holds that every store's read side is in reach and that no store's static imports leave its own module, so the order cannot matter. Saved views were one provider that switched between the feed and Plex by the active page and reset on each switch. The logic is now one hook (useSavedViewsStore) with an instance per module; the shared chip, popover and modal read the views their page or rail hands down. A feed view applied and edited now survives a visit to Plex. Plex's views are still asked for only on its page, and a module's manage modal still closes when its page is left. The feed's URL-override check applies only on the feed page, where its filter params live. The Channels store's tab type moves from the page into the store's context.
This commit is contained in:
+12
-30
@@ -7,11 +7,7 @@ import ErrorBoundary from "./shell/ErrorBoundary";
|
||||
import { ConfirmProvider } from "./components/ui/ConfirmProvider";
|
||||
import BootGate, { BootScreen } from "./shell/BootGate";
|
||||
import { NavigationProvider } from "./features/navigation/NavigationProvider";
|
||||
import { FeedFiltersProvider, FeedViewProvider, SavedViewsProvider } from "./modules/feed";
|
||||
import { PlaylistsProvider } from "./modules/playlists";
|
||||
import { FilesProvider } from "./modules/files";
|
||||
import { PlexProvider } from "./modules/plex";
|
||||
import { ChannelsProvider } from "./modules/channels";
|
||||
import { ModuleStores } from "./features/navigation/ModuleStores";
|
||||
import { PrefsProvider } from "./features/prefs/PrefsProvider";
|
||||
import { WizardProvider } from "./features/wizard/WizardProvider";
|
||||
import "./i18n";
|
||||
@@ -77,31 +73,17 @@ const root =
|
||||
seeds per-account state in its initializer (see BootGate). */}
|
||||
<BootGate>
|
||||
<NavigationProvider>
|
||||
<FeedFiltersProvider>
|
||||
<PlaylistsProvider>
|
||||
<FilesProvider>
|
||||
<PlexProvider>
|
||||
{/* SavedViewsProvider sits below BOTH filter providers so it can switch its
|
||||
source (feed ⟷ plex) by the active page and read the right live filters. */}
|
||||
<SavedViewsProvider>
|
||||
<ChannelsProvider>
|
||||
<FeedViewProvider>
|
||||
<PrefsProvider>
|
||||
<WizardProvider>
|
||||
{/* The same quiet screen as the gate's, so a chunk that is still
|
||||
loading when the gate opens continues it instead of blanking. */}
|
||||
<Suspense fallback={<BootScreen />}>
|
||||
<App />
|
||||
</Suspense>
|
||||
</WizardProvider>
|
||||
</PrefsProvider>
|
||||
</FeedViewProvider>
|
||||
</ChannelsProvider>
|
||||
</SavedViewsProvider>
|
||||
</PlexProvider>
|
||||
</FilesProvider>
|
||||
</PlaylistsProvider>
|
||||
</FeedFiltersProvider>
|
||||
<ModuleStores>
|
||||
<PrefsProvider>
|
||||
<WizardProvider>
|
||||
{/* The same quiet screen as the gate's, so a chunk that is still
|
||||
loading when the gate opens continues it instead of blanking. */}
|
||||
<Suspense fallback={<BootScreen />}>
|
||||
<App />
|
||||
</Suspense>
|
||||
</WizardProvider>
|
||||
</PrefsProvider>
|
||||
</ModuleStores>
|
||||
</NavigationProvider>
|
||||
</BootGate>
|
||||
</ConfirmProvider>
|
||||
|
||||
Reference in New Issue
Block a user