@@ -311,16 +311,17 @@ query getName {
311
311
CollectSubscriptionFields(objectType, selectionSet, visitedFragments):
312
312
313
313
- If {visitedFragments} is not provided, initialize it to the empty set.
314
- - Initialize {groupedFields } to an empty ordered map of lists .
314
+ - Initialize {collectedFieldsMap } to an empty ordered map of ordered sets .
315
315
- For each {selection} in {selectionSet}:
316
316
- {selection} must not provide the ` @skip ` directive.
317
317
- {selection} must not provide the ` @include ` directive.
318
318
- If {selection} is a {Field}:
319
- - Let {responseKey } be the response key of {selection} (the alias if
319
+ - Let {responseName } be the _ response name _ of {selection} (the alias if
320
320
defined, otherwise the field name).
321
- - Let {groupForResponseKey} be the list in {groupedFields} for
322
- {responseKey}; if no such list exists, create it as an empty list.
323
- - Append {selection} to the {groupForResponseKey}.
321
+ - Let {fieldsForResponseKey} be the _ field set_ value in
322
+ {collectedFieldsMap} for the key {responseName}; otherwise create the
323
+ entry with an empty ordered set.
324
+ - Add {selection} to the {fieldsForResponseKey}.
324
325
- If {selection} is a {FragmentSpread}:
325
326
- Let {fragmentSpreadName} be the name of {selection}.
326
327
- If {fragmentSpreadName} is in {visitedFragments}, continue with the next
@@ -334,31 +335,31 @@ CollectSubscriptionFields(objectType, selectionSet, visitedFragments):
334
335
- If {DoesFragmentTypeApply(objectType, fragmentType)} is {false}, continue
335
336
with the next {selection} in {selectionSet}.
336
337
- Let {fragmentSelectionSet} be the top-level selection set of {fragment}.
337
- - Let {fragmentGroupedFieldSet } be the result of calling
338
+ - Let {fragmentCollectedFieldMap } be the result of calling
338
339
{CollectSubscriptionFields(objectType, fragmentSelectionSet,
339
340
visitedFragments)}.
340
- - For each {fragmentGroup} in {fragmentGroupedFieldSet}:
341
- - Let {responseKey} be the response key shared by all fields in
342
- {fragmentGroup}.
343
- - Let {groupForResponseKey} be the list in {groupedFields} for
344
- {responseKey}; if no such list exists, create it as an empty list .
345
- - Append all items in {fragmentGroup } to {groupForResponseKey }.
341
+ - For each {fragmentCollectedFieldMap} as {responseName} and
342
+ {fragmentFields}:
343
+ - Let {fieldsForResponseKey} be the _ field set _ value in
344
+ {collectedFieldsMap} for the key {responseName}; otherwise create the
345
+ entry with an empty ordered set .
346
+ - Add each item from {fragmentFields } to {fieldsForResponseKey }.
346
347
- If {selection} is an {InlineFragment}:
347
348
- Let {fragmentType} be the type condition on {selection}.
348
349
- If {fragmentType} is not {null} and {DoesFragmentTypeApply(objectType,
349
350
fragmentType)} is {false}, continue with the next {selection} in
350
351
{selectionSet}.
351
352
- Let {fragmentSelectionSet} be the top-level selection set of {selection}.
352
- - Let {fragmentGroupedFieldSet } be the result of calling
353
+ - Let {fragmentCollectedFieldMap } be the result of calling
353
354
{CollectSubscriptionFields(objectType, fragmentSelectionSet,
354
355
visitedFragments)}.
355
- - For each {fragmentGroup} in {fragmentGroupedFieldSet}:
356
- - Let {responseKey} be the response key shared by all fields in
357
- {fragmentGroup}.
358
- - Let {groupForResponseKey} be the list in {groupedFields} for
359
- {responseKey}; if no such list exists, create it as an empty list .
360
- - Append all items in {fragmentGroup } to {groupForResponseKey }.
361
- - Return {groupedFields }.
356
+ - For each {fragmentCollectedFieldMap} as {responseName} and
357
+ {fragmentFields}:
358
+ - Let {fieldsForResponseKey} be the _ field set _ value in
359
+ {collectedFieldsMap} for the key {responseName}; otherwise create the
360
+ entry with an empty ordered set .
361
+ - Add each item from {fragmentFields } to {fieldsForResponseKey }.
362
+ - Return {collectedFieldsMap }.
362
363
363
364
Note: This algorithm is very similar to {CollectFields()}, it differs in that it
364
365
does not have access to runtime variables and thus the ` @skip ` and ` @include `
0 commit comments