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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where selection set flattening uses the wrong parent type #8664

Merged
merged 3 commits into from Dec 1, 2022

Conversation

jdmoody
Copy link
Contributor

@jdmoody jdmoody commented Nov 30, 2022

Description

Related #7364 and #6874

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Screenshots/Sandbox (if appropriate/relevant):

Here's a screenshot of how the test fails without the bugfix:
failing_test

How Has This Been Tested?

  • I created a new unit test in ts-documents.spec.ts that fails before the fix and succeeds afterwards.
  • I plan on testing this on a codebase with a large schema. I'll update this comment when I have verified it works on our codebase.

Checklist:

  • I have followed the CONTRIBUTING doc and the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

This is just #6874 with a unit test to show what has been fixed 馃槄 @mvestergaard did all the hard work here

The important features of the schema and query used in the test are:

  • The snake field returns a SnakeResult and all the child fields are within a ... on Snake inline fragment with a type condition. (I tried having the snake field return a type Snake, instead, but this did not cause a bug)
  • The Bat and Snake subtypes of Animal both have a field named features, but they are of a different type.

There might be other test cases that cause the same error because what @cecchi described in #7364 seems to be slightly different than the issue I was able to repro.

@changeset-bot
Copy link

changeset-bot bot commented Nov 30, 2022

馃 Changeset detected

Latest commit: 96819f6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@graphql-codegen/visitor-plugin-common Patch
@graphql-codegen/typescript-operations Patch
@graphql-codegen/typescript-document-nodes Patch
@graphql-codegen/gql-tag-operations Patch
@graphql-codegen/typescript-resolvers Patch
@graphql-codegen/typed-document-node Patch
@graphql-codegen/typescript Patch
@graphql-codegen/graphql-modules-preset Patch
@graphql-codegen/client-preset Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mvestergaard
Copy link
Contributor

That's awesome! Thanks for figuring out a way to replicate it in a test @jdmoody

Copy link
Collaborator

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

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

Awesome, thank you 鉂わ笍

Can you please also generate a changeset? See #8664 (comment)

@jdmoody
Copy link
Contributor Author

jdmoody commented Dec 1, 2022

Can you please also generate a changeset? See #8664 (comment)

Updated! Thanks for all your work on such an excellent OS library.

Copy link
Collaborator

@saihaj saihaj left a comment

Choose a reason for hiding this comment

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

great work!

@saihaj saihaj merged commit 62f6554 into dotansimha:master Dec 1, 2022
@saihaj
Copy link
Collaborator

saihaj commented Dec 1, 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

4 participants