@@ -11,11 +11,7 @@ import { AuthenticationClientService } from '../../auth/authentication-client-se
1111import { SketchbookTreeModel } from '../sketchbook/sketchbook-tree-model' ;
1212import { WorkspaceNode } from '@theia/navigator/lib/browser/navigator-tree' ;
1313import { 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' ;
1915import {
2016 LocalCacheFsProvider ,
2117 LocalCacheUri ,
@@ -24,7 +20,6 @@ import URI from '@theia/core/lib/common/uri';
2420import { SketchCache } from './cloud-sketch-cache' ;
2521import { Create } from '../../create/typings' ;
2622import { nls } from '@theia/core/lib/common/nls' ;
27- import { DisposableCollection } from '@theia/core/lib/common/disposable' ;
2823import { Deferred } from '@theia/core/lib/common/promise-util' ;
2924
3025export function sketchBaseDir ( sketch : Create . Sketch ) : FileStat {
@@ -72,24 +67,14 @@ export class CloudSketchbookTreeModel extends SketchbookTreeModel {
7267 @inject ( SketchCache )
7368 private readonly sketchCache : SketchCache ;
7469
75- private readonly toDisposeOnSessionDidChange = new DisposableCollection ( ) ;
7670 private _localCacheFsProviderReady : Deferred < void > | undefined ;
7771
7872 @postConstruct ( )
7973 protected override init ( ) : void {
8074 super . init ( ) ;
8175 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 ( ) )
9177 ) ;
92- this . ensureLocalFsProviderReady ( ) ;
9378 }
9479
9580 override * getNodesByUri ( uri : URI ) : IterableIterator < TreeNode > {
@@ -119,11 +104,11 @@ export class CloudSketchbookTreeModel extends SketchbookTreeModel {
119104 }
120105
121106 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+ ) ;
127112 }
128113
129114 override async refresh (
0 commit comments