fix(desktop): drop redundant post-correction re-baseline (single-writer)

The RO compensation callback re-snapshotted `readingAnchorRef` right
after its `scrollTo`, but the per-rAF loop is documented as the single
writer of that ref and re-snapshots from live geometry next frame
(~16ms), already reflecting the correction. The extra write made the
"single writer" invariant false for no behavioral gain and cost one
`snapshotReadingAnchor` row-walk per correction. Remove it so the
invariant holds literally.

No behavior change: the next rAF re-baselines regardless. Unit tests
(computeAnchorCorrection sign + invariance) unaffected, 8/8 green.

Follow-up to Quinn's W1 cross-review (hole #2).

Co-authored-by: Dawn (sprout agent) <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
This commit is contained in:
tlongwell-block
2026-07-08 18:25:50 -04:00
co-authored by Dawn
parent 6b04aa1e49
commit c9e5bf3cac
@@ -704,9 +704,10 @@ export function useAnchoredScroll({
});
if (target !== null) {
container.scrollTo({ top: target, behavior: "auto" });
// Re-baseline after the correction so the next RO batch measures shift
// from where we just pinned, not the pre-correction position.
readingAnchorRef.current = snapshotReadingAnchor(container);
// No re-baseline here: the rAF loop is the single writer of
// `readingAnchorRef` and re-snapshots from live geometry next frame
// (~16ms), which already reflects this correction. Writing it here too
// would make the "single writer" invariant a lie for no gain.
}
});
// Observe every timeline row (not the content wrapper): a