Skip to content

Commit 9997e98

Browse files
committed
fix(incrementalDelivery): filtering should never filter the error source
use explicit undefined to ensure that all code points are covered
1 parent 80325b5 commit 9997e98

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/execution/execute.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -734,15 +734,15 @@ function executeField(
734734
return completed.then(undefined, (rawError) => {
735735
const error = locatedError(rawError, fieldNodes, pathToArray(path));
736736
const handledError = handleFieldError(error, returnType, errors);
737-
filterSubsequentPayloads(exeContext, path);
737+
filterSubsequentPayloads(exeContext, path, asyncPayloadRecord);
738738
return handledError;
739739
});
740740
}
741741
return completed;
742742
} catch (rawError) {
743743
const error = locatedError(rawError, fieldNodes, pathToArray(path));
744744
const handledError = handleFieldError(error, returnType, errors);
745-
filterSubsequentPayloads(exeContext, path);
745+
filterSubsequentPayloads(exeContext, path, asyncPayloadRecord);
746746
return handledError;
747747
}
748748
}
@@ -1027,7 +1027,11 @@ async function completeAsyncIteratorValue(
10271027
pathToArray(itemPath),
10281028
);
10291029
const handledError = handleFieldError(error, itemType, errors);
1030-
filterSubsequentPayloads(exeContext, itemPath);
1030+
filterSubsequentPayloads(
1031+
exeContext,
1032+
itemPath,
1033+
asyncPayloadRecord,
1034+
);
10311035
return handledError;
10321036
}),
10331037
);
@@ -1037,7 +1041,7 @@ async function completeAsyncIteratorValue(
10371041
} catch (rawError) {
10381042
completedResults.push(null);
10391043
const error = locatedError(rawError, fieldNodes, pathToArray(itemPath));
1040-
filterSubsequentPayloads(exeContext, itemPath);
1044+
filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord);
10411045
handleFieldError(error, itemType, errors);
10421046
}
10431047
} catch (rawError) {
@@ -1157,7 +1161,7 @@ function completeListValue(
11571161
pathToArray(itemPath),
11581162
);
11591163
const handledError = handleFieldError(error, itemType, errors);
1160-
filterSubsequentPayloads(exeContext, itemPath);
1164+
filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord);
11611165
return handledError;
11621166
}),
11631167
);
@@ -1167,7 +1171,7 @@ function completeListValue(
11671171
} catch (rawError) {
11681172
const error = locatedError(rawError, fieldNodes, pathToArray(itemPath));
11691173
const handledError = handleFieldError(error, itemType, errors);
1170-
filterSubsequentPayloads(exeContext, itemPath);
1174+
filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord);
11711175
completedResults.push(handledError);
11721176
}
11731177
index++;
@@ -2052,8 +2056,8 @@ async function executeStreamIterator(
20522056

20532057
function filterSubsequentPayloads(
20542058
exeContext: ExecutionContext,
2055-
nullPath?: Path,
2056-
currentAsyncRecord?: AsyncPayloadRecord,
2059+
nullPath: Path | undefined,
2060+
currentAsyncRecord: AsyncPayloadRecord | undefined,
20572061
): void {
20582062
const nullPathArray = pathToArray(nullPath);
20592063
exeContext.subsequentPayloads.forEach((asyncRecord) => {

0 commit comments

Comments
 (0)