@@ -276,6 +276,9 @@ export class IncrementalPublisher {
276
276
277
277
publishInitial ( ) {
278
278
for ( const child of this . _initialResult . children ) {
279
+ if ( child . filtered ) {
280
+ continue ;
281
+ }
279
282
this . _publish ( child ) ;
280
283
}
281
284
}
@@ -299,11 +302,7 @@ export class IncrementalPublisher {
299
302
}
300
303
301
304
this . _delete ( child ) ;
302
- const parent =
303
- child . parentContext === undefined
304
- ? this . _initialResult
305
- : child . parentContext ;
306
- parent . children . delete ( child ) ;
305
+ child . filtered = true ;
307
306
308
307
if ( isStreamItemsRecord ( child ) ) {
309
308
if ( child . asyncIterator !== undefined ) {
@@ -364,6 +363,9 @@ export class IncrementalPublisher {
364
363
for ( const incrementalDataRecord of completedRecords ) {
365
364
const incrementalResult : IncrementalResult = { } ;
366
365
for ( const child of incrementalDataRecord . children ) {
366
+ if ( child . filtered ) {
367
+ continue ;
368
+ }
367
369
this . _publish ( child ) ;
368
370
}
369
371
if ( isStreamItemsRecord ( incrementalDataRecord ) ) {
@@ -435,20 +437,16 @@ export class DeferredFragmentRecord {
435
437
label : string | undefined ;
436
438
path : Array < string | number > ;
437
439
data : ObjMap < unknown > | null ;
438
- parentContext : IncrementalDataRecord | undefined ;
439
440
children : Set < IncrementalDataRecord > ;
440
441
isCompleted : boolean ;
441
- constructor ( opts : {
442
- label : string | undefined ;
443
- path : Path | undefined ;
444
- parentContext : IncrementalDataRecord | undefined ;
445
- } ) {
442
+ filtered : boolean ;
443
+ constructor ( opts : { label : string | undefined ; path : Path | undefined } ) {
446
444
this . label = opts . label ;
447
445
this . path = pathToArray ( opts . path ) ;
448
- this . parentContext = opts . parentContext ;
449
446
this . errors = [ ] ;
450
447
this . children = new Set ( ) ;
451
448
this . isCompleted = false ;
449
+ this . filtered = false ;
452
450
this . data = null ;
453
451
}
454
452
}
@@ -459,25 +457,24 @@ export class StreamItemsRecord {
459
457
label : string | undefined ;
460
458
path : Array < string | number > ;
461
459
items : Array < unknown > | null ;
462
- parentContext : IncrementalDataRecord | undefined ;
463
460
children : Set < IncrementalDataRecord > ;
464
461
asyncIterator : AsyncIterator < unknown > | undefined ;
465
462
isCompletedAsyncIterator ?: boolean ;
466
463
isCompleted : boolean ;
464
+ filtered : boolean ;
467
465
constructor ( opts : {
468
466
label : string | undefined ;
469
467
path : Path | undefined ;
470
468
asyncIterator ?: AsyncIterator < unknown > ;
471
- parentContext : IncrementalDataRecord | undefined ;
472
469
} ) {
473
470
this . items = null ;
474
471
this . label = opts . label ;
475
472
this . path = pathToArray ( opts . path ) ;
476
- this . parentContext = opts . parentContext ;
477
473
this . asyncIterator = opts . asyncIterator ;
478
474
this . errors = [ ] ;
479
475
this . children = new Set ( ) ;
480
476
this . isCompleted = false ;
477
+ this . filtered = false ;
481
478
this . items = null ;
482
479
}
483
480
}
0 commit comments