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