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 merging of fetch groups for @requires #1431

Merged
merged 1 commit into from
Jan 27, 2022

Conversation

pcmanus
Copy link
Contributor

@pcmanus pcmanus commented Jan 25, 2022

When computing entity fetches for query plans, we keep track for an
entity fetch of the path into it's "parent" group. But when doing so,
we were keeping the "cast" into the entity type if present. Not only
is that unecessary since entity fetches inputs/selections always start
with casting into the proper entity type, it was harmful as it means
that the logic for @require was sometimes not recognizing that it
could merge fetches (due to those casts), sometimes yielding (obviously)
ineffecient plans.

Copy link
Contributor

@clenfest clenfest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had one minor comment

query-planner-js/src/buildPlan.ts Outdated Show resolved Hide resolved
When computing entity fetches for query plans, we keep track for an
entity fetch of the path into it's "parent" group. But when doing so,
we were keeping the "cast" into the entity type if present. Not only
is that unecessary since entity fetches inputs/selections always start
with casting into the proper entity type, it was harmful as it means
that the logic for @require was sometimes not recognizing that it
could merge fetches (due to those casts), sometimes yielding (obviously)
ineffecient plans.
@codesandbox-ci
Copy link

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.

@pcmanus pcmanus merged commit 3597471 into apollographql:main Jan 27, 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.

2 participants