-
Notifications
You must be signed in to change notification settings - Fork 1.2k
MergedField single field support #4056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5613d0f
dbd0711
05ef826
8bd0257
33c20ae
d98674b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,12 +41,11 @@ public MergedSelectionSet collectFields(FieldCollectorParameters parameters, Mer | |
| public MergedSelectionSet collectFields(FieldCollectorParameters parameters, MergedField mergedField, boolean incrementalSupport) { | ||
| Map<String, MergedField> subFields = new LinkedHashMap<>(); | ||
| Set<String> visitedFragments = new LinkedHashSet<>(); | ||
| for (Field field : mergedField.getFields()) { | ||
| if (field.getSelectionSet() == null) { | ||
| continue; | ||
| mergedField.forEach(field -> { | ||
| if (field.getSelectionSet() != null) { | ||
| this.collectFields(parameters, field.getSelectionSet(), visitedFragments, subFields, null, incrementalSupport); | ||
| } | ||
| this.collectFields(parameters, field.getSelectionSet(), visitedFragments, subFields, null, incrementalSupport); | ||
| } | ||
| }); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a consumer pattern - not wont materialise the list to consume the values |
||
| return newMergedSelectionSet().subFields(subFields).build(); | ||
| } | ||
|
|
||
|
|
@@ -142,11 +141,8 @@ private void collectField(FieldCollectorParameters parameters, Map<String, Merge | |
| } | ||
| String name = field.getResultKey(); | ||
| if (fields.containsKey(name)) { | ||
| MergedField curFields = fields.get(name); | ||
| fields.put(name, curFields.transform(builder -> builder | ||
| .addField(field) | ||
| .addDeferredExecution(deferredExecution)) | ||
| ); | ||
| MergedField currentMergedField = fields.get(name); | ||
| fields.put(name, currentMergedField.newMergedFieldWith(field,deferredExecution)); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| } else { | ||
| fields.put(name, MergedField.newSingletonMergedField(field, deferredExecution)); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont materialise the list just to get the first one and its result key