File tree 1 file changed +5
-3
lines changed
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
36
36
private agentWatchers : Record < WorkspaceAgent [ "id" ] , AgentWatcher > = { }
37
37
private timeout : NodeJS . Timeout | undefined
38
38
private fetching = false
39
+ private visible = false
39
40
40
41
constructor (
41
42
private readonly getWorkspacesQuery : WorkspaceQuery ,
@@ -48,10 +49,10 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
48
49
// fetchAndRefresh fetches new workspaces, re-renders the entire tree, then
49
50
// keeps refreshing (if a timer length was provided) as long as the user is
50
51
// 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.
53
54
async fetchAndRefresh ( ) {
54
- if ( this . fetching ) {
55
+ if ( this . fetching || ! this . visible ) {
55
56
return
56
57
}
57
58
this . fetching = true
@@ -146,6 +147,7 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
146
147
* Either start or stop the refresh timer based on visibility.
147
148
*/
148
149
setVisibility ( visible : boolean ) {
150
+ this . visible = visible
149
151
if ( ! visible ) {
150
152
this . cancelPendingRefresh ( )
151
153
} else {
You can’t perform that action at this time.
0 commit comments