Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCM repo view: often all entries are selected #113803

Closed
bpasero opened this issue Jan 5, 2021 · 13 comments
Closed

SCM repo view: often all entries are selected #113803

bpasero opened this issue Jan 5, 2021 · 13 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug papercut 🩸 A particularly annoying issue impacting someone on the team scm General SCM compound issues verified Verification succeeded
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Jan 5, 2021

I was not yet able to pin down the issue but every once in a while I see the SCM repo view select all repos, even though it should just be one. Most often I see the view state restore properly but sometimes not.

image

Filing this issue to see if someone else is seeing this too and to maybe add some logging when this happens to nail it down?

PS: I am using the web version, but not sure if that matters. When is this state persisted? On shutdown maybe long running?

@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug scm General SCM compound issues labels Jan 5, 2021
@joaomoreno joaomoreno added this to the Backlog milestone Jan 8, 2021
@bpasero bpasero added the papercut 🩸 A particularly annoying issue impacting someone on the team label Jan 29, 2021
@bpasero
Copy link
Member Author

bpasero commented Mar 18, 2021

I figured out this seems to happen consistently when an update is applied and then the window reloads/restarts. So somehow that UI state is not preserved when we restart from an update (macOS). Is this state computed long running in an extension or all in workbench?

@joaomoreno
Copy link
Member

State is persisted on onWillSaveState:

private onWillSaveState(): void {
if (!this.didFinishLoading) { // don't remember state, if the workbench didn't really finish loading
return;
}
const all = this.scmService.repositories.map(r => getProviderStorageKey(r.provider));
const visible = this.visibleRepositories.map(r => all.indexOf(getProviderStorageKey(r.provider)));
const raw = JSON.stringify({ all, visible });
this.storageService.store('scm:view:visibleRepositories', raw, StorageScope.WORKSPACE, StorageTarget.MACHINE);
}

Restoring the state is tricky since SCM providers come delayed, and the SCM world must have timeouts to consider when no more SCM providers are expected to load. It's filled with heuristics, which might fail in that case. One of those heuristics is: if we go 2 seconds without any providers being loaded, we stop considering any more providers, in order to restore view state:

@bpasero
Copy link
Member Author

bpasero commented Mar 18, 2021

@joaomoreno ah ok, just to know what is going on, can you logService.warn when that timeout is hit so that I can see if I am hitting this case? I would think the onWillSaveState is handled properly because otherwise I would loose all my UI state after an update is applied.

@joaomoreno
Copy link
Member

Added trace logs 👍

@joaomoreno
Copy link
Member

joaomoreno commented Nov 9, 2021

Optimistically closing this with the fix from #120089. @bpasero Let me know if you still see it after that fix gets pushed to insiders.

@joaomoreno joaomoreno modified the milestones: Backlog, November 2021 Nov 9, 2021
@heartacker
Copy link
Contributor

git-repos

@lszomoru lszomoru reopened this Nov 22, 2021
@lszomoru lszomoru modified the milestones: November 2021, December 2021 Nov 29, 2021
@joaomoreno joaomoreno removed their assignment Jan 24, 2022
@lszomoru lszomoru modified the milestones: January 2022, Backlog Jan 24, 2022
@lszomoru lszomoru modified the milestones: Backlog, March 2022 Mar 21, 2022
@lszomoru
Copy link
Member

Optimistically closing this with 5c65b18.
@bpasero, let me know if you will still experience this issue. Thanks!

@bpasero bpasero added the verified Verification succeeded label Mar 22, 2022
@bpasero
Copy link
Member Author

bpasero commented Mar 22, 2022

So far so good, will report back if I ever see this again.

@heartacker
Copy link
Contributor

image

I can repro again

版本: 1.66.0-insider (system setup)
提交: b0966ed
日期: 2022-03-22T07:31:08.410Z
Electron: 17.1.2
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Windows_NT x64 10.0.14393

@heartacker
Copy link
Contributor

when reload

@lszomoru
Copy link
Member

@heartacker, you have to be a little more specific.
What steps do you follow and what is the behaviour that you are seeing?
Are you clicking on any of the repositories while the repositories are being discovered?

@heartacker
Copy link
Contributor

  1. reload windows which has multi repos
  2. all repos are selected while repos are being discovered

@lszomoru
Copy link
Member

This behaviour is expected, as I have tried to provide a consistent experience while repositories are being discovered:

  1. When you open a folder/workspace containing multiple repositories for the very first time, all repositories are being selected as they are being discovered, and are being added to the list of repositories in the "Source Control Repositories" view.
  2. When you open a folder/workspace containing multiple repositories that has a previous selection:
    • if the repository is not part of the saved selection, we will add it to the list and select it
    • if the repository is part of the saved selection, we will add it to the list, and reset the selection so this is the only selected repository
    • if the repository is not part of the saved selection, we will add it to the list but not select it

@github-actions github-actions bot locked and limited conversation to collaborators May 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug papercut 🩸 A particularly annoying issue impacting someone on the team scm General SCM compound issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants
@joaomoreno @bpasero @heartacker @lszomoru and others