docs(nav): note the render-time ref is the intentional latest-value pattern

This commit is contained in:
2026-07-18 02:24:19 +02:00
parent a1bdfece6d
commit 7819c2e3a0
@@ -95,6 +95,9 @@ export function NavigationProvider({ children }: { children: ReactNode }) {
// Refs so the STABLE action callbacks can read the latest state without depending on it — a dep
// would recreate them on every navigation and re-render every actions consumer (e.g. VideoCard).
// Written during render (the sanctioned "latest value" pattern): the ref is only READ in event
// handlers after commit, and this provider never suspends or renders in a transition, so no
// discarded render can leave it stale.
const pageRef = useRef(page);
pageRef.current = page;
const channelViewRef = useRef(channelView);