Skip to content

[Fix] Don't get a freshly cloned repo stuck in a loading state in project explorer#9998

Open
moirahuang wants to merge 3 commits intomasterfrom
moira/debug-file-tree
Open

[Fix] Don't get a freshly cloned repo stuck in a loading state in project explorer#9998
moirahuang wants to merge 3 commits intomasterfrom
moira/debug-file-tree

Conversation

@moirahuang
Copy link
Copy Markdown
Contributor

Description

Fixes #9846 by making sure we don't overwrite with an empty entry if we have a lazy loaded index.

Linked Issue

#9846

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Screenshots / Videos

https://www.loom.com/share/0213603002f84250b6366d99cb938a5c

Testing

Locally tested: https://www.loom.com/share/0213603002f84250b6366d99cb938a5c

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

@cla-bot cla-bot Bot added the cla-signed label May 3, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 3, 2026

@moirahuang

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Some(state.entry.clone())
}
Some(IndexedRepoState::Pending) => {
// Repo is being (re-)indexed. Keep whatever entry
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@moirahuang moirahuang requested a review from alokedesai May 3, 2026 23:08
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_directory now 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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File tree sidebar does not load when opened immediately after cloning a repository

1 participant