Skip to content

Commit f223dbc

Browse files
Fix inaccurate doc
1 parent 54c601a commit f223dbc

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/components/InterlinearNavContext.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,11 @@ export function InterlinearNavProvider({
259259

260260
const navigate = useCallback(
261261
(newScrRef: SerializedVerseRef, origin: NavOrigin = 'external') => {
262-
// Invariant: a marker write is ALWAYS paired with the `setScrRef` below. The `liveScrRef` memo
263-
// reads this marker but lists only `[rawScrRef]` as a dependency, relying on every marker write
264-
// also pushing a new ref through the host (which re-runs the memo). Never set a marker here
265-
// without the accompanying `setScrRef`, or the memo could read a stale marker.
262+
// Invariant: a marker write is ALWAYS paired with the `setScrRef` below. The marker readers
263+
// that run during render — the render-phase mid-reveal guard, which lists only `[rawScrRef]`
264+
// in the reactive path that reaches it — rely on every marker write also pushing a new ref
265+
// through the host, so the render that reads the marker is the one that sees it fresh. Never
266+
// set a marker here without the accompanying `setScrRef`, or a reader could see a stale marker.
266267
if (origin === 'internal') pendingInternalNavRef.current.set(verseKey(newScrRef), Date.now());
267268
setScrRef(newScrRef);
268269
},

0 commit comments

Comments
 (0)