fix: skip include logic handling multiple paths to same node #197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR
To use the new behaviour, use the new CompilerOption -
Description
When there are multiple paths to the same field Node (fragments), there can be multiple skip/include requirements for the same node. This breaks our assumption in the existing implementation where we compute the skip/include for a particular field node and use the same for all paths.
For example,
Here, in this query, the field
target
has two paths -paths.one.target
, andpaths.two.target
. But, in the current implementation we compute__internalShouldInclude
for a particular field node - so this gets reused for all paths to the field Node - so is the reason for the bug.This PR fixes it by remodelling the internal representation. This PR uses a path specific skip/include logic and while generating code, it uses the path specific logic. We represent this as an object -
__internalShouldIncludePaths[path.in.dot.notation] = SkipIncludeCode
for that path.