docs(nav): note the render-time ref is the intentional latest-value pattern
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user