Skip to content
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

Fix potential rogue expansion of fragments when deoptimizing #2098

Merged
merged 2 commits into from
Aug 26, 2022

Conversation

pcmanus
Copy link
Contributor

@pcmanus pcmanus commented Aug 25, 2022

The code from #1911 ensures that named fragments from the user query are
reused in subgraph query "when appropriate", but there were some code
path where a fragment that was reused (correctly) could end up be
"re-expanded" (due to an existing method not handling spreads properly).

The resulting subgraph query ended up with the fragment definition
existing but never being used, which is invalid in graphQL.

This patch ensures that a reused fragment is not mistakenly re-expanded
by the code (and thus avoids a query with unused fragments).

Fixes #2092

@netlify
Copy link

netlify bot commented Aug 25, 2022

👷 Deploy request for apollo-federation-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 91a0eed

@pcmanus pcmanus self-assigned this Aug 25, 2022
@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 25, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Sylvain Lebresne added 2 commits August 26, 2022 09:06
The code from apollographql#1911 ensures that named fragments from the user query are
reused in subgraph query "when appropriate", but there were some code
path where a fragment that was reused (correctly) could end up be
"re-expanded" (due to an existing method not handling spreads properly).

The resulting subgraph query ended up with the fragment definition
existing but never being used, which is invalid in graphQL.

This patch ensures that a reused fragment is not mistakenly re-expanded
by the code (and thus avoids a query with unused fragments).

Fixes apollographql#2092
@pcmanus pcmanus merged commit 7c06bfd into apollographql:main Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Querying fragments result in incorrect downstream requests
2 participants