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.
17 lines
655 B
TypeScript
17 lines
655 B
TypeScript
import type { ReactNode } from "react";
|
|
import { FeedFiltersProvider } from "./FeedFiltersProvider";
|
|
import { FeedViewProvider } from "./FeedViewProvider";
|
|
import { FeedSavedViewsProvider } from "./FeedSavedViewsProvider";
|
|
|
|
// The feed module's store, mounted at the root (features/navigation/ModuleStores): its filters, its view
|
|
// (the card or row layout) and its saved views over those filters.
|
|
export function FeedStore({ children }: { children: ReactNode }) {
|
|
return (
|
|
<FeedFiltersProvider>
|
|
<FeedViewProvider>
|
|
<FeedSavedViewsProvider>{children}</FeedSavedViewsProvider>
|
|
</FeedViewProvider>
|
|
</FeedFiltersProvider>
|
|
);
|
|
}
|