Skip to content

Commit 2d80144

Browse files
committed
yield all available payloads together as a list
1 parent 98e0f76 commit 2d80144

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

spec/Section 6 -- Execution.md

+24-21
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ ExecuteQuery(query, schema, variableValues, initialValue):
142142
{hasNext} with the value {true}.
143143
- Let {iterator} be the result of running
144144
{YieldSubsequentPayloads(subsequentPayloads)}.
145-
- For each {payload} yielded by {iterator}:
145+
- For each {payloadList} yielded by {iterator}:
146146
- If a termination signal is received:
147147
- Send a termination signal to {iterator}.
148148
- Return.
149149
- Otherwise:
150-
- Yield {payload}.
150+
- Yield {payloadList}.
151151

152152
### Mutation
153153

@@ -175,12 +175,12 @@ ExecuteMutation(mutation, schema, variableValues, initialValue):
175175
{hasNext} with the value {true}.
176176
- Let {iterator} be the result of running
177177
{YieldSubsequentPayloads(subsequentPayloads)}.
178-
- For each {payload} yielded by {iterator}:
178+
- For each {payloadList} yielded by {iterator}:
179179
- If a termination signal is received:
180180
- Send a termination signal to {iterator}.
181181
- Return.
182182
- Otherwise:
183-
- Yield {payload}.
183+
- Yield {payloadList}.
184184

185185
### Subscription
186186

@@ -337,12 +337,12 @@ ExecuteSubscriptionEvent(subscription, schema, variableValues, initialValue):
337337
{hasNext} with the value {true}.
338338
- Let {iterator} be the result of running
339339
{YieldSubsequentPayloads(subsequentPayloads)}.
340-
- For each {payload} yielded by {iterator}:
340+
- For each {payloadList} yielded by {iterator}:
341341
- If a termination signal is received:
342342
- Send a termination signal to {iterator}.
343343
- Return.
344344
- Otherwise:
345-
- Yield {payload}.
345+
- Yield {payloadList}.
346346

347347
Note: The {ExecuteSubscriptionEvent()} algorithm is intentionally similar to
348348
{ExecuteQuery()} since this is how each event result is produced.
@@ -372,21 +372,24 @@ YieldSubsequentPayloads(subsequentPayloads):
372372
- If {record} contains {iterator}:
373373
- Send a termination signal to {iterator}.
374374
- Return.
375-
- Let {record} be the first item in {subsequentPayloads} with a completed
376-
{dataExecution}.
377-
- Remove {record} from {subsequentPayloads}.
378-
- If {isCompletedIterator} on {record} is {true}:
379-
- If {subsequentPayloads} is empty:
380-
- Yield a map containing a field `hasNext` with the value {false}.
381-
- Return.
382-
- If {subsequentPayloads} is not empty:
383-
- Continue to the next record in {subsequentPayloads}.
384-
- Let {payload} be the completed result returned by {dataExecution}.
385-
- If {record} is not the final element in {subsequentPayloads}:
386-
- Add an entry to {payload} named `hasNext` with the value {true}.
387-
- If {record} is the final element in {subsequentPayloads}:
388-
- Add an entry to {payload} named `hasNext` with the value {false}.
389-
- Yield {payload}
375+
- Let {completed} be the next set of items in {subsequentPayloads} with
376+
completed {dataExecution} results.
377+
- Initialize {payloadList} to an empty list.
378+
- For each {record} in {completed}.
379+
- Remove {record} from {subsequentPayloads}.
380+
- If {isCompletedIterator} on {record} is {true}:
381+
- If {subsequentPayloads} is empty:
382+
- Yield a map containing a field `hasNext` with the value {false}.
383+
- Return.
384+
- If {subsequentPayloads} is not empty:
385+
- Continue to the next record in {subsequentPayloads}.
386+
- Let {payload} be the completed result returned by {dataExecution}.
387+
- If {record} is not the final element in {subsequentPayloads}:
388+
- Add an entry to {payload} named `hasNext` with the value {true}.
389+
- If {record} is the final element in {subsequentPayloads}:
390+
- Add an entry to {payload} named `hasNext` with the value {false}.
391+
- Append {payload} to {payloadList}
392+
- Yield {payloadList}
390393

391394
## Executing Selection Sets
392395

0 commit comments

Comments
 (0)