Fix file tree refresh logic#10184
Merged
kevinyang372 merged 1 commit intomasterfrom May 5, 2026
Merged
Conversation
Contributor
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
Contributor
There was a problem hiding this comment.
Overview
This PR narrows file tree flattened-item rebuilds to the affected root for repository metadata updates, while preserving full rebuild behavior for existing call sites that need it.
Concerns
- No blocking correctness or security concerns found in the changed diff.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
moirahuang
approved these changes
May 5, 2026
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.

Description
Fix local file tree blinking and reshuffling after connecting to an SSH session.
Root cause: When a remote SSH session is active, the remote server streams frequent
FileTreeEntryUpdated { Remote }events for every filesystem change on the remote host.The previous code called
rebuild_flattened_items()on each such event, which re-flattenedall roots (including local ones), causing the local file tree to re-render on every remote
filesystem change — visible as constant blinking/reshuffling.
Fix: Add an optional
target_rootparameter to the corerebuild_flatten_items_implmethod. When
Some, only the specified root is re-flattened; all other roots keep theirexisting items untouched. Three thin wrappers provide the public API:
rebuild_flattened_items_for_root(path)— single-root rebuildrebuild_flattened_items()— full rebuild (all roots)rebuild_flattened_items_without(path)— full rebuild excluding a deleted pathUpdated the following event handlers to use per-root rebuilds instead of full rebuilds:
FileTreeEntryUpdated { Local }— rebuilds only the affected local root(s)FileTreeEntryUpdated { Remote }— rebuilds only the affected remote rootRepositoryRemoved { Remote }— no-op rebuild (root already removed), avoids touching remaining rootsSkipping unchanged roots is safe because the rebuild is fully deterministic given the same
entry,expanded_folders, anditem_states— re-flattening an unmodified root producesan identical items list and selection index.
Testing
cargo check -p warp --libpasses cleanlyrebuild_flatten_items_implcorrectlyAgent Mode