Skip to content

Align codegen and language server inline fragment __typename use#2473

Merged
hwillson merged 1 commit intomasterfrom
typename-fragment-issue
Nov 11, 2021
Merged

Align codegen and language server inline fragment __typename use#2473
hwillson merged 1 commit intomasterfrom
typename-fragment-issue

Conversation

@hwillson
Copy link
Copy Markdown
Member

@hwillson hwillson commented Nov 9, 2021

The withTypenameFieldAddedWhereNeeded utility in apollo-language-server was updated in #1286 to make sure __typename's are added to inline fragments, when used by commands like client:push. The apollo-codegen-core package currently uses its own copy of withTypenameFieldAddedWhereNeeded however, which was not updated. This means that operations can be registered (in Apollo's operation registry) via client:push that don't line up with the operations output by codegen.

This commit adjusts the apollo-codegen-core package to use the same withTypenameFieldAddedWhereNeeded function as apollo-language-server (which is already a dependency of codegen), to make sure the operations output from codegen line up with the operations pushed via client:push.

@hwillson hwillson self-assigned this Nov 9, 2021
@hwillson hwillson force-pushed the typename-fragment-issue branch 2 times, most recently from 9c414e3 to 21730c0 Compare November 9, 2021 23:35
The `withTypenameFieldAddedWhereNeeded` utility in `apollo-language-server`
was updated in #1286 to make sure `__typename`'s are added to inline
fragments, when used by commands like `client:push`. The
`apollo-codegen-core` package currently uses its own copy of
`withTypenameFieldAddedWhereNeeded` however, which was not updated. This
means that operations can be registered (in Apollo's operation registry)
via `client:push` that don't line up with the operations output by codegen.

This commit adjusts the `apollo-codegen-core` package to use the same
`withTypenameFieldAddedWhereNeeded` function as `apollo-language-server`
(which is already a dependency of codegen), to make sure the operations
output from codegen line up with the operations pushed via
`client:push`.
Comment thread packages/apollo-codegen-core/src/compiler/index.ts
Comment thread packages/apollo-language-server/src/graphqlTypes.ts
Copy link
Copy Markdown
Member

@calvincestari calvincestari left a comment

Choose a reason for hiding this comment

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

Thanks for the help in getting this fixed Hugh! 🥇

@hwillson hwillson merged commit 9eaf49e into master Nov 11, 2021
@hwillson hwillson deleted the typename-fragment-issue branch November 11, 2021 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants