[Fix] Don't get a freshly cloned repo stuck in a loading state in project explorer#9998
[Fix] Don't get a freshly cloned repo stuck in a loading state in project explorer#9998moirahuang wants to merge 3 commits intomasterfrom
Conversation
|
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 |
| Some(state.entry.clone()) | ||
| } | ||
| Some(IndexedRepoState::Pending) => { | ||
| // Repo is being (re-)indexed. Keep whatever entry |
There was a problem hiding this comment.
i debated removing this comment and the comment below but i think they are actually helpful in explaining the decision here to prevent future regressions
There was a problem hiding this comment.
Overview
This PR keeps existing project-explorer entries while repository metadata is pending so freshly cloned repositories do not flash back to a loading state during lazy-loaded-to-indexed transitions.
Concerns
register_and_refresh_lazy_loaded_directorynow preserves any non-empty existing entry whenever the metadata lookup returns no entry, including failed or untracked paths, which can leave stale children visible instead of resetting the root.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| // prior lazy-loaded index that is now being upgraded to a full git | ||
| // repo). Overwriting with an empty entry causes the tree to flash | ||
| // back to a loading state during the Pending → Indexed transition. | ||
| let has_children = root_dir |
There was a problem hiding this comment.
entry == None also covers failed or untracked paths, such as a deleted directory, so using child count preserves stale children; gate this preservation on IndexedRepoState::Pending instead.
Description
Fixes #9846 by making sure we don't overwrite with an empty entry if we have a lazy loaded index.
Linked Issue
#9846
ready-to-specorready-to-implement.Screenshots / Videos
https://www.loom.com/share/0213603002f84250b6366d99cb938a5c
Testing
Locally tested: https://www.loom.com/share/0213603002f84250b6366d99cb938a5c
Agent Mode