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

Optimize plan for defer where only keys are fetched #2182

Merged
merged 3 commits into from Oct 20, 2022

Conversation

pcmanus
Copy link
Contributor

@pcmanus pcmanus commented Oct 5, 2022

Router-based defer is based on using an entity key to "resume" the deferred part of a @defer, but that means that at least the key(s) needs to be fetched in the non-deferred part. But if only the key were selected in the deferred part, the code was issuing a new deferred fetch to get those key field "again". This commit avoids this by recognizing that those key fields don't need to be fetched again.

@pcmanus pcmanus self-assigned this Oct 5, 2022
@netlify
Copy link

netlify bot commented Oct 5, 2022

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

Visit the deploys page to approve it

Name Link
🔨 Latest commit 888a82c

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 5, 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.

} else {
const parents = group.parents();
const parent = parents[0];
if (parents.length === 1 && parent.path) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for my understanding, what are the conditions under which a parent wouldn't have a path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is some cases where the path doesn't really make sense at I explained in this comment. But more concretely, it show in code paths at least here and here.

Sylvain Lebresne added 2 commits October 19, 2022 17:40
Router-based defer is based on using an entity key to "resume" the
deferred part of a `@defer`, but that means that at least the key(s)
needs to be fetched in the non-deferred part. But if only the key
were selected in the deferred part, the code was issuing a new
deferred fetch to get those key field "again". This commit avoids
this by recognizing that those key fields don't need to be fetched
again.
@pcmanus pcmanus merged commit 72dffce into apollographql:main Oct 20, 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.

None yet

2 participants