SCM - Avoid redundant refreshes of the Repositories view for child repositories - #338592
Open
Keith Daulton (d13) wants to merge 1 commit into
Open
Keith Daulton (d13) wants to merge 1 commit into
Keith Daulton (d13) wants to merge 1 commit into
Conversation
…positories When the Repositories view is not in explorer mode, child repositories (e.g. worktrees) are nested under their parent. updateRepository() refreshed the parent and then fell through to a full recursive refresh of the tree, and every history item ref change triggered another parent refresh and expand. With many worktree repositories this caused the parent row to collapse and re-expand about twice per worktree during startup. Return after refreshing the parent, and only react to history item ref changes in explorer mode, where they affect the artifact groups. Fixes microsoft#338547
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Ladislau Szomoru (@lszomoru)Matched files:
|
This branch has not been deployed
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.
Fixes #338547
When the Source Control Repositories view isn't in explorer mode (
scm.repositories.explorer: false, the default), child repositories such as worktrees are nested under their parent repository row. With many worktree repositories open (for example,git.detectWorktrees: truewith 50 worktrees), the view refreshes the whole tree and collapses/re-expands the parent row about twice per worktree during startup.There are two causes in
scmRepositoriesViewPane.ts:updateRepository()falls through to a full refresh. For a child repository, it refreshes the parent viaupdateParentRepository()and then falls through toupdateChildren(), a full recursive refresh of the tree.parentId, so a child repository change can't change them.updateChildren(parent)already re-evaluates the parent'shasChildren.historyItemRefsubscription isn't gated on explorer mode. Every history item ref change triggersupdateRepository(), even though outside explorer mode there are no artifact groups for a ref change to affect.explorerEnabledConfig, the same way the artifact-group subscription right above it already is.Verification
MutationObserver on
.scm-repositories-viewin Insiders 1.140.0, 50 worktree repositories. The fixed versions of the two methods were applied at runtime toSCMRepositoriesViewPane.prototypebefore the view initialized:Explorer mode (
scm.repositories.explorer: true) is unchanged.