-
Notifications
You must be signed in to change notification settings - Fork 283
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(federation): fixed sibling typename optimization handling multiple __typename selections #6141
Conversation
…iple __typename selections - updated to only fold a plain __typename without alias/directives. - also, fixed __typename ordering in fetch operations to put the plain __typename ahead of others.
✅ Docs Preview ReadyNo new or changed pages found. |
@duckki, please consider creating a changeset entry in |
CI performance tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM!
e; filed a ticket for the below.
I think we should audit all our __typename checks soon to see if we are doing the right thing, IIRC there are several places where we just == TYPENAME_FIELD
, sometimes checking for directives and sometimes not. I'd also like to know if we do the right thing when there are multiple typename selections with different aliases, and other edge cases
I've casually looked around and didn't find any other places that need to be fixed. But, it wasn't exhaustive. |
Problem
The sibling typename optimization treated __typename and __typename @Skip(if:$X) interchangeably. Thus, one could become a sibling of the other, depending on the order they appear in query. That is problematic, since sibling typename should not have directives or aliases.
The same issue found in JS QP. The matching PR for that is apollographql/federation#3164.
Rust QP didn't have the other problem dropping some __typename selections in fetch operations like JS QP. But, still ordering could be wrong, picking __typename with directives ahead of the plain
__typename
.Fix Summary
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.