File tree Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -591,7 +591,7 @@ describe('Execute: defer directive', () => {
591
591
] ) ;
592
592
} ) ;
593
593
594
- it ( 'Can deduplicate fields with deferred fragments at multiple levels' , async ( ) => {
594
+ it ( 'Can deduplicate initial fields with deferred fragments at multiple levels' , async ( ) => {
595
595
const document = parse ( `
596
596
query {
597
597
hero {
@@ -642,13 +642,16 @@ describe('Execute: defer directive', () => {
642
642
incremental : [
643
643
{
644
644
data : {
645
+ bar : 'bar' ,
646
+ baz : 'baz' ,
645
647
bak : 'bak' ,
646
648
} ,
647
649
path : [ 'hero' , 'nestedObject' , 'deeperObject' ] ,
648
650
} ,
649
651
{
650
652
data : {
651
653
deeperObject : {
654
+ bar : 'bar' ,
652
655
baz : 'baz' ,
653
656
} ,
654
657
} ,
@@ -729,7 +732,7 @@ describe('Execute: defer directive', () => {
729
732
] ) ;
730
733
} ) ;
731
734
732
- it ( 'can deduplicate fields with deferred fragments in different branches at multiple non-overlapping levels' , async ( ) => {
735
+ it ( 'can deduplicate initial fields with deferred fragments in different branches at multiple non-overlapping levels' , async ( ) => {
733
736
const document = parse ( `
734
737
query {
735
738
a {
@@ -776,7 +779,9 @@ describe('Execute: defer directive', () => {
776
779
incremental : [
777
780
{
778
781
data : {
779
- e : { } ,
782
+ e : {
783
+ f : 'f' ,
784
+ } ,
780
785
} ,
781
786
path : [ 'a' , 'b' ] ,
782
787
} ,
Original file line number Diff line number Diff line change @@ -669,25 +669,15 @@ function shouldExecuteFieldSet(
669
669
fieldSet : ReadonlyArray < TaggedFieldNode > ,
670
670
deferDepth : number | undefined ,
671
671
) : boolean {
672
- if ( deferDepth === undefined ) {
672
+ if ( deferDepth === undefined || ! isLeafType ( getNamedType ( returnType ) ) ) {
673
673
return fieldSet . some (
674
- ( { deferDepth : fieldDeferDepth } ) => fieldDeferDepth === undefined ,
674
+ ( { deferDepth : fieldDeferDepth } ) => fieldDeferDepth === deferDepth ,
675
675
) ;
676
676
}
677
677
678
- if ( ! isLeafType ( getNamedType ( returnType ) ) ) {
679
- let hasDepth = false ;
680
- for ( const { deferDepth : fieldDeferDepth } of fieldSet ) {
681
- if ( fieldDeferDepth === deferDepth ) {
682
- hasDepth = true ;
683
- }
684
- }
685
- return hasDepth ;
686
- }
687
-
688
678
let hasDepth = false ;
689
679
for ( const { deferDepth : fieldDeferDepth } of fieldSet ) {
690
- if ( fieldDeferDepth === undefined || fieldDeferDepth < deferDepth ) {
680
+ if ( fieldDeferDepth === undefined ) {
691
681
return false ;
692
682
}
693
683
if ( fieldDeferDepth === deferDepth ) {
You can’t perform that action at this time.
0 commit comments