Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(incrementalDelivery): filtering should never affect the error source #3753

Merged
merged 2 commits into from
Sep 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/execution/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,15 +734,15 @@ function executeField(
return completed.then(undefined, (rawError) => {
const error = locatedError(rawError, fieldNodes, pathToArray(path));
const handledError = handleFieldError(error, returnType, errors);
filterSubsequentPayloads(exeContext, path);
filterSubsequentPayloads(exeContext, path, asyncPayloadRecord);
return handledError;
});
}
return completed;
} catch (rawError) {
const error = locatedError(rawError, fieldNodes, pathToArray(path));
const handledError = handleFieldError(error, returnType, errors);
filterSubsequentPayloads(exeContext, path);
filterSubsequentPayloads(exeContext, path, asyncPayloadRecord);
return handledError;
}
}
Expand Down Expand Up @@ -1027,7 +1027,11 @@ async function completeAsyncIteratorValue(
pathToArray(itemPath),
);
const handledError = handleFieldError(error, itemType, errors);
filterSubsequentPayloads(exeContext, itemPath);
filterSubsequentPayloads(
exeContext,
itemPath,
asyncPayloadRecord,
);
return handledError;
}),
);
Expand All @@ -1037,7 +1041,7 @@ async function completeAsyncIteratorValue(
} catch (rawError) {
completedResults.push(null);
const error = locatedError(rawError, fieldNodes, pathToArray(itemPath));
filterSubsequentPayloads(exeContext, itemPath);
filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord);
handleFieldError(error, itemType, errors);
}
} catch (rawError) {
Expand Down Expand Up @@ -1157,7 +1161,7 @@ function completeListValue(
pathToArray(itemPath),
);
const handledError = handleFieldError(error, itemType, errors);
filterSubsequentPayloads(exeContext, itemPath);
filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord);
return handledError;
}),
);
Expand All @@ -1167,7 +1171,7 @@ function completeListValue(
} catch (rawError) {
const error = locatedError(rawError, fieldNodes, pathToArray(itemPath));
const handledError = handleFieldError(error, itemType, errors);
filterSubsequentPayloads(exeContext, itemPath);
filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord);
completedResults.push(handledError);
}
index++;
Expand Down Expand Up @@ -1991,7 +1995,7 @@ async function executeStreamIterator(
fieldNodes: ReadonlyArray<FieldNode>,
info: GraphQLResolveInfo,
itemType: GraphQLOutputType,
path?: Path,
path: Path,
label?: string,
parentContext?: AsyncPayloadRecord,
): Promise<void> {
Expand Down Expand Up @@ -2052,8 +2056,8 @@ async function executeStreamIterator(

function filterSubsequentPayloads(
exeContext: ExecutionContext,
nullPath?: Path,
currentAsyncRecord?: AsyncPayloadRecord,
nullPath: Path,
currentAsyncRecord: AsyncPayloadRecord | undefined,
yaacovCR marked this conversation as resolved.
Show resolved Hide resolved
): void {
const nullPathArray = pathToArray(nullPath);
exeContext.subsequentPayloads.forEach((asyncRecord) => {
Expand Down