@@ -458,12 +458,45 @@ either resolving to {null} if allowed or further propagated to a parent field.
458458If this occurs, any sibling fields which have not yet executed or have not yet
459459yielded a value may be cancelled to avoid unnecessary work.
460460
461- Additionally, the path of each {asyncRecord} in {subsequentPayloads} must be
462- compared with the path of the field that ultimately resolved to {null}. If the
463- path of any {asyncRecord} starts with the path of the resolved {null}, the
464- {asyncRecord} must be removed from {subsequentPayloads} and its result must not
465- be sent to clients. If these async records have not yet executed or have not yet
466- yielded a value they may also be cancelled to avoid unnecessary work.
461+ Additionally, async payload records in {subsequentPayloads} must be filtered if
462+ their path points to a location that has resolved to {null} due to propagation
463+ of a field error. This is described in
464+ [ Filter Subsequent Payloads] ( #sec-Filter-Subsequent-Payloads ) . These async
465+ payload records must be removed from {subsequentPayloads} and their result must
466+ not be sent to clients. If these async records have not yet executed or have not
467+ yet yielded a value they may also be cancelled to avoid unnecessary work.
468+
469+ Note: See [ Handling Field Errors] ( #sec-Handling-Field-Errors ) for more about
470+ this behavior.
471+
472+ ### Filter Subsequent Payloads
473+
474+ When a field error is raised, there may be async payload records in
475+ {subsequentPayloads} with a path that points to a location that has been removed
476+ or set to null due to null propagation. These async payload records must be
477+ removed from subsequent payloads and their results must not be sent to clients.
478+
479+ In {FilterSubsequentPayloads}, {nullPath} is the path which has resolved to null
480+ after propagation as a result of a field error. {currentAsyncRecord} is the
481+ async payload record where the field error was raised. {currentAsyncRecord} will
482+ not be set for field errors that were raised during the initial execution
483+ outside of {ExecuteDeferredFragment} or {ExecuteStreamField}.
484+
485+ FilterSubsequentPayloads(subsequentPayloads, nullPath, currentAsyncRecord):
486+
487+ - For each {asyncRecord} in {subsequentPayloads}:
488+ - If {asyncRecord} is the same record as {currentAsyncRecord}:
489+ - Continue to the next record in {subsequentPayloads}.
490+ - Initialize {index} to zero.
491+ - While {index} is less then the length of {nullPath}:
492+ - Initialize {nullPathItem} to the element at {index} in {nullPath}.
493+ - Initialize {asyncRecordPathItem} to the element at {index} in the {path}
494+ of {asyncRecord}.
495+ - If {nullPathItem} is not equivalent to {asyncRecordPathItem}:
496+ - Continue to the next record in {subsequentPayloads}.
497+ - Increment {index} by one.
498+ - Remove {asyncRecord} from {subsequentPayloads}. Optionally, cancel any
499+ incomplete work in the execution of {asyncRecord}.
467500
468501For example, assume the field ` alwaysThrows ` is a ` Non-Null ` type that always
469502raises a field error:
@@ -490,9 +523,6 @@ be cancelled.
490523}
491524```
492525
493- Note: See [ Handling Field Errors] ( #sec-Handling-Field-Errors ) for more about
494- this behavior.
495-
496526### Normal and Serial Execution
497527
498528Normally the executor can execute the entries in a grouped field set in whatever
0 commit comments