File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ import {
43
43
GraphQLIncludeDirective ,
44
44
GraphQLSkipDirective ,
45
45
GraphQLDeferDirective ,
46
+ GraphQLStreamDirective ,
46
47
} from '../type/directives' ;
47
48
import {
48
49
type GraphQLObjectType ,
@@ -1054,10 +1055,46 @@ function completeListValue(
1054
1055
// No need to modify the info object containing the path,
1055
1056
// since from here on it is not ever accessed by resolver functions.
1056
1057
const fieldPath = addPath ( path , index ) ;
1058
+ const initialFieldNodes = [ ] ;
1059
+ for ( const fieldNode of fieldNodes ) {
1060
+ const stream = getDirectiveValues (
1061
+ GraphQLStreamDirective ,
1062
+ fieldNode ,
1063
+ exeContext . variableValues ,
1064
+ ) ;
1065
+ if (
1066
+ exeContext . schema . __experimentalStream &&
1067
+ stream &&
1068
+ stream . if !== false &&
1069
+ index >= stream . initial_count
1070
+ ) {
1071
+ const patchErrors = [ ] ;
1072
+ exeContext . dispatcher . add (
1073
+ stream . label ,
1074
+ fieldPath ,
1075
+ ( ) =>
1076
+ completeValueCatchingError (
1077
+ exeContext ,
1078
+ itemType ,
1079
+ [ fieldNode ] ,
1080
+ info ,
1081
+ fieldPath ,
1082
+ item ,
1083
+ patchErrors ,
1084
+ ) ,
1085
+ patchErrors ,
1086
+ ) ;
1087
+ } else {
1088
+ initialFieldNodes . push ( fieldNode ) ;
1089
+ }
1090
+ }
1091
+ if ( ! initialFieldNodes . length ) {
1092
+ return ;
1093
+ }
1057
1094
const completedItem = completeValueCatchingError (
1058
1095
exeContext ,
1059
1096
itemType ,
1060
- fieldNodes ,
1097
+ initialFieldNodes ,
1061
1098
info ,
1062
1099
fieldPath ,
1063
1100
item ,
You can’t perform that action at this time.
0 commit comments