@@ -253,7 +253,7 @@ export abstract class ViewNode<
253
253
}
254
254
255
255
protected _uniqueId ! : string ;
256
- protected splatted = false ;
256
+ splatted = false ;
257
257
// NOTE: @eamodio uncomment to track node leaks
258
258
// readonly uuid = uuid();
259
259
@@ -262,8 +262,12 @@ export abstract class ViewNode<
262
262
// public readonly id: string | undefined,
263
263
uri : GitUri ,
264
264
public readonly view : TView ,
265
- protected parent ?: ViewNode ,
265
+ protected parent ?: ViewNode | undefined ,
266
+ //** Indicates if this node is only shown as its children, not itself */
267
+ splatted ?: boolean ,
266
268
) {
269
+ this . splatted = splatted ?? false ;
270
+
267
271
// NOTE: @eamodio uncomment to track node leaks
268
272
// queueMicrotask(() => this.view.registerNode(this));
269
273
this . _uri = uri ;
@@ -339,32 +343,36 @@ export abstract class ViewNode<
339
343
340
344
getSplattedChild ?( ) : Promise < ViewNode | undefined > ;
341
345
346
+ protected get storedId ( ) : string | undefined {
347
+ return this . id ;
348
+ }
349
+
342
350
deleteState < T extends StateKey < State > = StateKey < State > > ( key ?: T ) : void {
343
- if ( this . id == null ) {
351
+ if ( this . storedId == null ) {
344
352
debugger ;
345
353
throw new Error ( 'Id is required to delete state' ) ;
346
354
}
347
- this . view . nodeState . deleteState ( this . id , key as string ) ;
355
+ this . view . nodeState . deleteState ( this . storedId , key as string ) ;
348
356
}
349
357
350
358
getState < T extends StateKey < State > = StateKey < State > > ( key : T ) : StateValue < State , T > | undefined {
351
- if ( this . id == null ) {
359
+ if ( this . storedId == null ) {
352
360
debugger ;
353
361
throw new Error ( 'Id is required to get state' ) ;
354
362
}
355
- return this . view . nodeState . getState ( this . id , key as string ) ;
363
+ return this . view . nodeState . getState ( this . storedId , key as string ) ;
356
364
}
357
365
358
366
storeState < T extends StateKey < State > = StateKey < State > > (
359
367
key : T ,
360
368
value : StateValue < State , T > ,
361
369
sticky ?: boolean ,
362
370
) : void {
363
- if ( this . id == null ) {
371
+ if ( this . storedId == null ) {
364
372
debugger ;
365
373
throw new Error ( 'Id is required to store state' ) ;
366
374
}
367
- this . view . nodeState . storeState ( this . id , key as string , value , sticky ) ;
375
+ this . view . nodeState . storeState ( this . storedId , key as string , value , sticky ) ;
368
376
}
369
377
}
370
378
0 commit comments