fix: Find keeps its match in view until the reader scrolls (no bead)
Merged
TE
25d ago+25+25+01234567890123456789-7-7-0123456789
Summary
chat-find.test.ts › finds command output and edit diffs inside a closed Worked for fold goes red on unrelated feat-cmux-next PRs: #19552, #19644, #19746 and #19761 in the last 12 hours. The failure is inView false at line 206 after settleInView's 5 s wait.
- Cause: Find held a new match in view for
FIND_REVEAL_MS = 600of wall time after it was first drawn. On a loaded runner the page is CPU-starved, and the "Worked for" fold the match opens and the rows above it measure after that window. The match then slides out of view and stays there. A starved Mac would show the same bug. - Fix: the hold keeps its bounded semantics but no longer depends on wall time alone. It ends only after both 36 animation frames and 600 ms, or after 5 s at most:
- A starved page draws fewer frames, so it keeps the match through measures that land late.
- On an idle 60 Hz or 120 Hz page it behaves exactly as before.
- A page hidden mid-reveal, which draws no frames, does not snap the reader back once shown.
- Each window owns a number, so a stale loop from an earlier reveal can't end a newer one early.
- Red test: the fold case runs under 40× CPU throttling over the Chrome DevTools Protocol (CDP), which reproduces the loaded runner.
- Dropped: an earlier revision held the match until the reader scrolled. Review showed that programmatic scrolls (Jump to latest, Previous/Next Turn) would snap back, so I dropped it.
Testing
- Red on 31399f703f15:
react-apps-checkfailedchat-find.test.ts:210(inViewfalse under throttling). - Green on f81e6ddfc5df:
PASS test/chat-find.test.ts. That job's other reds were thechat-header-changesbase break (#19794) and amenu-focuscold-startgototimeout. The latest head adds the review fixes and is re-running. Browser tests run only in CI or on a Freestyle VM, so not on big-red. bun run checkandbun test test/ui-rules.test.tspass locally.
Changelog
- Fixed: Find in Chat keeps a match inside a closed "Worked for" fold in view on a busy machine.
🤖 Generated with Claude Code