@@ -1076,6 +1076,44 @@ BuildGroupedFieldSets(fieldsByTarget, targetsByKey, parentTargets)
1076
1076
- Initialize {details} to an empty unordered map.
1077
1077
- Set the entry for {groupedFieldSet} in {details} to {newGroupedFieldSet}.
1078
1078
- Set the corresponding entry in {details} to {shouldInitiateDefer}.
1079
+ - Set the entry for {targets} in {groupDetailsMap} to {details}.
1080
+ - Return {groupedFieldSet} and {groupDetailsMap}.
1081
+
1082
+ Note: entries are always added to Grouped Field Set records in the order in
1083
+ which they appear for the first target. Field order for deferred grouped field
1084
+ sets never alters the field order for the parent.
1085
+
1086
+ GetTargetSetDetails(targetsByKey, parentTargets):
1087
+
1088
+ - Initialize {keysWithParentTargets} to the empty set.
1089
+ - Initialize {targetSetDetailsMap} to an empty unordered map.
1090
+ - For each {responseKey} and {targets} in {targetsByKey}:
1091
+ - If {IsSameSet(targets, parentTargets)} is {true}:
1092
+ - Append {responseKey} to {keysWithParentTargets}.
1093
+ - Continue to the next entry in {targetsByKey}.
1094
+ - For each {key} in {targetSetDetailsMap}:
1095
+ - If {IsSameSet(targets, key)} is {true}, let {targetSetDetails} be the map
1096
+ in {targetSetDetailsMap} for {targets}.
1097
+ - If {targetSetDetails} is defined:
1098
+ - Let {keys} be the corresponding entry on {targetSetDetails}.
1099
+ - Add {responseKey} to {keys}.
1100
+ - Otherwise:
1101
+ - Initialize {keys} to the empty set.
1102
+ - Add {responseKey} to {keys}.
1103
+ - Let {shouldInitiateDefer} be {false}.
1104
+ - For each {target} in {targets}:
1105
+ - Let {remainingFieldsForTarget} be the entry in {remainingFieldsByTarget}
1106
+ for {target}.
1107
+ - Let {nodes} be the list in {remainingFieldsByTarget} for {responseKey}.
1108
+ - Remove the entry for {responseKey} from {remainingFieldsByTarget}.
1109
+ - For each {node} of {nodes}:
1110
+ - Let {fieldDetails} be a new Field Details record created from {node}
1111
+ and {target}.
1112
+ - Append {fieldDetails} to the {fields} entry on {fieldGroup}.
1113
+ - Let {shouldInitiateDefer} be the corresponding entry on {targetSetDetails}.
1114
+ - Initialize {details} to an empty unordered map.
1115
+ - Set the entry for {groupedFieldSet} in {details} to {newGroupedFieldSet}.
1116
+ - Set the corresponding entry in {details} to {shouldInitiateDefer}.
1079
1117
- Set the entry for {maskingTargets} in {groupDetailsMap} to {details}.
1080
1118
- Return {groupedFieldSet} and {groupDetailsMap}.
1081
1119
@@ -1116,7 +1154,7 @@ GetTargetSetDetails(targetsByKey, parentTargets):
1116
1154
- Set {shouldInitiateDefer} equal to {true}.
1117
1155
- Create {newTargetSetDetails} as an map containing {keys} and
1118
1156
{shouldInitiateDefer}.
1119
- - Set the entry in {targetSetDetailsMap} for {maskingTargets } to
1157
+ - Set the entry in {targetSetDetailsMap} for {targets } to
1120
1158
{newTargetSetDetails}.
1121
1159
- Return {keysWithParentTargets} and {targetSetDetailsMap}.
1122
1160
@@ -1129,6 +1167,15 @@ IsSameSet(setA, setB):
1129
1167
- Return {false}.
1130
1168
- Return {true}.
1131
1169
1170
+ GetOrderedResponseKeys(targets, fieldsByTarget):
1171
+
1172
+ - Let {firstTarget} be the first entry in {targets}.
1173
+ - Assert that {firstTarget} is defined.
1174
+ - Let {firstFields} be the entry for {firstTarget} in {fieldsByTarget}.
1175
+ - Assert that {firstFields} is defined.
1176
+ - Let {responseKeys} be the keys of {firstFields}.
1177
+ - Return {responseKeys}.
1178
+
1132
1179
## Executing Deferred Grouped Field Sets
1133
1180
1134
1181
ExecuteDeferredGroupedFieldSets(objectType, objectValue, variableValues, path,
0 commit comments