@@ -11,11 +11,7 @@ import { AuthenticationClientService } from '../../auth/authentication-client-se
11
11
import { SketchbookTreeModel } from '../sketchbook/sketchbook-tree-model' ;
12
12
import { WorkspaceNode } from '@theia/navigator/lib/browser/navigator-tree' ;
13
13
import { CreateUri } from '../../create/create-uri' ;
14
- import {
15
- FileChangesEvent ,
16
- FileChangeType ,
17
- FileStat ,
18
- } from '@theia/filesystem/lib/common/files' ;
14
+ import { FileChangesEvent , FileStat } from '@theia/filesystem/lib/common/files' ;
19
15
import {
20
16
LocalCacheFsProvider ,
21
17
LocalCacheUri ,
@@ -24,7 +20,6 @@ import URI from '@theia/core/lib/common/uri';
24
20
import { SketchCache } from './cloud-sketch-cache' ;
25
21
import { Create } from '../../create/typings' ;
26
22
import { nls } from '@theia/core/lib/common/nls' ;
27
- import { DisposableCollection } from '@theia/core/lib/common/disposable' ;
28
23
import { Deferred } from '@theia/core/lib/common/promise-util' ;
29
24
30
25
export function sketchBaseDir ( sketch : Create . Sketch ) : FileStat {
@@ -72,24 +67,14 @@ export class CloudSketchbookTreeModel extends SketchbookTreeModel {
72
67
@inject ( SketchCache )
73
68
private readonly sketchCache : SketchCache ;
74
69
75
- private readonly toDisposeOnSessionDidChange = new DisposableCollection ( ) ;
76
70
private _localCacheFsProviderReady : Deferred < void > | undefined ;
77
71
78
72
@postConstruct ( )
79
73
protected override init ( ) : void {
80
74
super . init ( ) ;
81
75
this . toDispose . push (
82
- this . authenticationService . onSessionDidChange ( ( session ) => {
83
- this . updateRoot ( ) ;
84
- this . toDisposeOnSessionDidChange . dispose ( ) ;
85
- if ( session ) {
86
- this . toDisposeOnSessionDidChange . push (
87
- this . fileService . watch ( CreateUri . root )
88
- ) ;
89
- }
90
- } )
76
+ this . authenticationService . onSessionDidChange ( ( ) => this . updateRoot ( ) )
91
77
) ;
92
- this . ensureLocalFsProviderReady ( ) ;
93
78
}
94
79
95
80
override * getNodesByUri ( uri : URI ) : IterableIterator < TreeNode > {
@@ -119,11 +104,11 @@ export class CloudSketchbookTreeModel extends SketchbookTreeModel {
119
104
}
120
105
121
106
protected override isRootAffected ( changes : FileChangesEvent ) : boolean {
122
- return changes . changes . some (
123
- ( change ) =>
124
- change . type === FileChangeType . ADDED &&
125
- change . resource . parent . toString ( ) === LocalCacheUri . root . toString ( )
126
- ) ;
107
+ return changes . changes
108
+ . map ( ( { resource } ) => resource )
109
+ . some (
110
+ ( uri ) => uri . parent . toString ( ) . startsWith ( LocalCacheUri . root . toString ( ) ) // all files under the root might effect the tree
111
+ ) ;
127
112
}
128
113
129
114
override async refresh (
0 commit comments