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.
14 lines
497 B
TypeScript
14 lines
497 B
TypeScript
import type { ReactNode } from "react";
|
|
import { PlexProvider } from "./PlexProvider";
|
|
import { PlexSavedViewsProvider } from "./PlexSavedViewsProvider";
|
|
|
|
// The Plex module's store, mounted at the root (features/navigation/ModuleStores): its browse state, and
|
|
// its saved views over that state's filters.
|
|
export function PlexStore({ children }: { children: ReactNode }) {
|
|
return (
|
|
<PlexProvider>
|
|
<PlexSavedViewsProvider>{children}</PlexSavedViewsProvider>
|
|
</PlexProvider>
|
|
);
|
|
}
|