File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
3636 private agentWatchers : Record < WorkspaceAgent [ "id" ] , AgentWatcher > = { }
3737 private timeout : NodeJS . Timeout | undefined
3838 private fetching = false
39+ private visible = false
3940
4041 constructor (
4142 private readonly getWorkspacesQuery : WorkspaceQuery ,
@@ -48,10 +49,10 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
4849 // fetchAndRefresh fetches new workspaces, re-renders the entire tree, then
4950 // keeps refreshing (if a timer length was provided) as long as the user is
5051 // still logged in and no errors were encountered fetching workspaces.
51- // Calling this while already refreshing is a no-op and will return
52- // immediately.
52+ // Calling this while already refreshing or not visible is a no-op and will
53+ // return immediately.
5354 async fetchAndRefresh ( ) {
54- if ( this . fetching ) {
55+ if ( this . fetching || ! this . visible ) {
5556 return
5657 }
5758 this . fetching = true
@@ -146,6 +147,7 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
146147 * Either start or stop the refresh timer based on visibility.
147148 */
148149 setVisibility ( visible : boolean ) {
150+ this . visible = visible
149151 if ( ! visible ) {
150152 this . cancelPendingRefresh ( )
151153 } else {
You can’t perform that action at this time.
0 commit comments