-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: excluded the __typename from the root node of subscriptions when…
… using addTypenameSelectionDocumentTransform with documentTransforms (#9889) * Excluded the __typename from the root node of subscriptions The __typename should not be added to the root node of a subscription since a single root node is expected and the code generator fails because of that * Added the changeset * Test for the fix for issue #9889 * Lint fix * No need for capturing the variable
- Loading branch information
Showing
4 changed files
with
144 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/client-preset': minor | ||
--- | ||
|
||
The \_\_typename should not be added to the root node of a subscription when using addTypenameSelectionDocumentTransform with documentTransforms since a single root node is expected and the code generator fails because of that (refer to https://spec.graphql.org/draft/#sec-Single-root-field) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/presets/client/tests/fixtures/subscription-root-node.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
//@ts-ignore | ||
import gql from 'gql-tag'; | ||
|
||
gql(` | ||
subscription onRegionCreated { | ||
onRegionCreated{ | ||
regionId | ||
regionDescription | ||
} | ||
} | ||
`); |