refactor(nav): lift navigation + history into NavigationProvider

Move page/channelView/ytSearch and the history/popstate/title effects out of the
App god component into a new NavigationProvider (split state/actions contexts so
the memo'd VideoCard doesn't re-render on a page/channel switch). App consumes it
via useNavigation/useNavigationActions but still passes the props down for now;
the consumer migration that removes the prop-drilling follows.
This commit is contained in:
2026-07-18 02:06:07 +02:00
parent cabc759a31
commit 41bb1b2ab3
3 changed files with 217 additions and 120 deletions
+4 -1
View File
@@ -3,6 +3,7 @@ import { createRoot } from "react-dom/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import ErrorBoundary from "./components/ErrorBoundary";
import { ConfirmProvider } from "./components/ConfirmProvider";
import { NavigationProvider } from "./components/NavigationProvider";
import "./i18n";
import "./index.css";
@@ -35,7 +36,9 @@ const root =
<QueryClientProvider client={queryClient}>
<ErrorBoundary>
<ConfirmProvider>
<App />
<NavigationProvider>
<App />
</NavigationProvider>
</ConfirmProvider>
</ErrorBoundary>
</QueryClientProvider>