refactor(nav): read navigation from context, drop the prop-drilling

VideoCard/PlayerModal read openChannel from useNavigationActions (the memo'd
VideoCard subscribes to the STABLE actions context, so a page/channel change
no longer re-renders it); NavSidebar/Header read page/setPage; ChannelPage
reads closeChannel; NotificationsPanel reads setPage. App sheds the matching
props, and Feed/VirtualFeed no longer thread onOpenChannel at all.
This commit is contained in:
2026-07-18 02:19:52 +02:00
parent 41bb1b2ab3
commit a1bdfece6d
9 changed files with 20 additions and 53 deletions
-15
View File
@@ -88,7 +88,6 @@ export default function Feed({
ytSearch,
onYtSearch,
onExitYtSearch,
onOpenChannel,
channelScoped,
}: {
filters: FeedFilters;
@@ -107,9 +106,6 @@ export default function Feed({
ytSearch: string | null;
onYtSearch: (q: string) => void;
onExitYtSearch: () => void;
// Open a channel's dedicated page (from a card's channel name / avatar). Threaded down to
// the cards via VirtualFeed.
onOpenChannel?: (channelId: string, channelName?: string) => void;
// True when this feed is scoped to a single channel (the channel page). Drops sort options
// that are constant within one channel (subscribers, priority) — they'd be meaningless.
channelScoped?: boolean;
@@ -308,13 +304,6 @@ export default function Feed({
[qc]
);
const handleOpenChannel = useCallback(
(channelId: string, channelName: string) => {
onOpenChannel?.(channelId, channelName);
},
[onOpenChannel]
);
const onToggleSave = useCallback(
(id: string, saved: boolean) => {
setSavedOverrides((o) => ({ ...o, [id]: saved }));
@@ -447,7 +436,6 @@ export default function Feed({
view={view}
onState={onState}
onToggleSave={onToggleSave}
onOpenChannel={handleOpenChannel}
onResetState={onResetState}
onOpen={openVideo}
hasNextPage={false}
@@ -480,7 +468,6 @@ export default function Feed({
queue={ytPlayerQueue}
onClose={() => setActiveVideo(null)}
onState={onState}
onOpenChannel={onOpenChannel}
/>
</Suspense>
)}
@@ -698,7 +685,6 @@ export default function Feed({
view={view}
onState={onState}
onToggleSave={onToggleSave}
onOpenChannel={handleOpenChannel}
onResetState={onResetState}
onOpen={openVideo}
hasNextPage={!!hasNextPage}
@@ -714,7 +700,6 @@ export default function Feed({
queue={playerQueue}
onClose={() => setActiveVideo(null)}
onState={onState}
onOpenChannel={onOpenChannel}
/>
</Suspense>
)}