Fix delayed autofocus cleanup so hidden thoughts are shimmed - #4969
Merged
raineorshine merged 2 commits intoAug 17, 2026
Merged
Conversation
Co-Authored-By: Codex GPT-5 (unknown context) <noreply@openai.com>
marcus-pousette
force-pushed
the
fix/delayed-autofocus-virtualization
branch
from
August 17, 2026 13:09
30f4406 to
04ba7a0
Compare
This was referenced Aug 17, 2026
Contributor
Author
|
Pupeeteer seem to be red, investigating |
Co-Authored-By: Codex GPT-5 (unknown context) <noreply@openai.com>
marcus-pousette
force-pushed
the
fix/delayed-autofocus-virtualization
branch
from
August 17, 2026 18:01
448f885 to
df4535f
Compare
raineorshine
approved these changes
Aug 17, 2026
raineorshine
left a comment
Contributor
There was a problem hiding this comment.
Excellent, thank you
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #2399.
Related to the iOS Safari deep-navigation report in #4325.
Problem
useDelayedAutofocussets anunmountedref in its effect cleanup. React runs that cleanup before everyautofocus-driven rerun, not only on unmount, so the ref becomes permanently true after the first transition. Subsequent delayed updates are discarded.During progressive deep navigation, thoughts that move to
hidetherefore never become lightweight fixed-height shims. Their full editor trees remain mounted after leaving the visible layout, causing DOM and WebContent memory to grow with depth.Solution
unmountedflag.hidethoughts are unmounted,hide-parentthoughts remain mounted for the existing fade-in behavior, and navigating back remounts the ancestor.This is deliberately narrower than #2582: it does not change
Subthought/VirtualThoughtlayout, opacity, orhide-parentbehavior that was implicated in the Safari regression in #2650.Physical-device results
Measured on an iPhone 13 mini running iOS 26.6 in Mobile Safari with the same 150-level
Hello1…Hello150fixture and a 75-step slow-scroll run lasting about 65 seconds. WebContent process metrics were sampled at roughly 1 Hz.The before/after builds were based on the same TreeCRDT integration revision because that is the reported surface; the affected hook and layout code are identical to upstream
main. An unpatched upstream-main control showed the same retention behavior and averaged 926.6 MB during the scroll.These are directional measurements from one physical-device run per build, not a formal benchmark. Neither build hard-reloaded on iOS 26.6; the original hard reload was reported on iOS 26.5.2, so confirmation on the affected device is still needed. Navigating back 20 levels after the patched run did not reproduce the y-position drift from #2650.
Verification
athought remains mounted.yarn lint:tscyarn lint:srcyarn build