Repository navigation
fix(web): opening a very large folder no longer freezes the Files panel - #930
Merged
Merged
Conversation
Scient's lazy Files tree applied each listing to the tree as one batch, and the tree reworks a folder's children for every row added or removed: opening a 50,000-entry folder blocked the panel for seconds, and a refresh after most of it was deleted for about 15 s. When the batch would cost more than a rebuild (T3's measured break-even, as in its #29996), the tree is rebuilt from the known entries and then given one real change as a small batch, so it still clears a drag, remaps rename, focus and selection, and refreshes an open search as a batch does. When entries changed kind, a first rebuild without either form ends a rename or selection on them, so neither moves to the replacement. Rows the tree shows before the disk has them, such as a new entry being named, are tracked and kept unless their folder is removed. Removed entries are forgotten in one pass instead of one scan each. With a search open, a large listing that removes matching rows can show the old matches for one update, which may scroll the results to the top; opening a folder only adds rows and keeps the scroll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
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.
Stacked on #929 (the T3 2bee33e alignment); it retargets to
mainonce #929 merges.Opening a folder with tens of thousands of entries no longer freezes the Files panel. A 50,000-entry folder now opens in about 170 ms instead of blocking the panel for seconds, and a refresh after most of a large folder was deleted no longer blocks for about 15 s.
Why it froze
Scient's lazy Files tree applied each folder listing to the tree as one batch. The tree (
@pierre/trees) re-indexes a folder's later children and rebuilds its visible-count chunks for every row it adds or removes, so a batch costs the folder's size for every row in it:T3 fixed the same freeze in its own tree (#29996). Scient keeps its lazy tree, so the alignment did not carry T3's fix; this ports the idea.
What changes
addProvisionaland kept, unless their folder is removed.Known limit: with a search open, a large listing that removes matching rows shows the old matches for one update, which can scroll the results to the top. The tree has no atomic rebuild-and-refresh, and the alternative is a freeze of up to 15 s. Opening a folder only adds rows, and a test shows the results never shrink then.
Found, not changed here: any folder listing that arrives while a new Files entry is being named takes the focus from the name field, which then makes the entry with its first name. It happens with a 5-entry listing too, and on the alignment branch without this change. It needs its own fix.
Verification
FileBrowserPanel): a 50,000-entry folder, names out of order, opens with the open folder kept; without the change the folder does not appear within the test's wait. An open search stays accurate while the folder's listing arrives. The Files panel, folder actions, panel files column and bidi suites pass (23 tests).Platforms
🤖 Generated with Claude Code