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 bug when field covariance meet type-explosion #1859

Merged
merged 1 commit into from
May 18, 2022

Conversation

pcmanus
Copy link
Contributor

@pcmanus pcmanus commented May 16, 2022

As we build selection sets during query planning, and due to how query
planning work, we have cases where we try to add an interface field (as
coming from the original query) to a selection set whose parent type is
one of the interface implementation. As we do, the code recognize this
case and make sure to use the proper implementation field instead (so
that the resulting selection remains a well-typed object). But that
code was slightly buggy in 2 small ways (we updated the field added,
but didn't update its sub-selection set accordindly, and
SelectionSet#add method was returning the original selection instead
of the added (and potentially updated) one). This fixes those issues.

Fixes #1858

@netlify
Copy link

netlify bot commented May 16, 2022

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

Visit the deploys page to approve it

Name Link
🔨 Latest commit f216dbc

@pcmanus pcmanus self-assigned this May 16, 2022
@codesandbox-ci
Copy link

codesandbox-ci bot commented May 16, 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.

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.

LGTM

As we build selection sets during query planning, and due to how query
planning work, we have cases where we try to add an interface field (as
coming from the original query) to a selection set whose parent type is
one of the interface implementation. As we do, the code recognize this
case and make sure to use the proper implementation field instead (so
that the resulting selection remains a well-typed object). But that
code was slightly buggy in 2 small ways (we updated the field added,
but didn't update its sub-selection set accordindly, and
`SelectionSet#add` method was returning the original selection instead
of the added (and potentially updated) one). This fixes those issues.

Fixes apollographql#1858
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.

Certain queries error when Federation v1 supergraph has covariance in field types
2 participants