-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add @defer
directive support
#9196
Merged
Merged
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
b2f1fe6
Add initial typescript `@defer` support
hwillson 9696d7e
Add defer apollo example
beerose 6658aaa
Add union of initial and deferred fields
beerose d03e08d
Merge branch 'master' into defer-support
beerose b5443b1
Update cypress version in example
beerose 162269d
Fix ternary order
beerose 65694a5
Refactor code a bit
beerose 0d8a6b9
Update tests
beerose 982c511
Fix handling __typename
beerose 0ccb06b
Support avoidOptionals: true
beerose 969e979
Update example
beerose 4d56086
Merge branch 'master' into defer-support
beerose 9e225d3
Add MakeEmpty type
beerose d68995d
Change test names
beerose 43402e8
Update example
beerose 4fe8ca0
Add failing test
beerose 7b7e0a6
Modify example to contain a failing test
beerose 84395ac
Add an expected output to the new test
beerose eb2c276
Handle generating types with inlineFragmentTypes mask
beerose be07d4e
Merge branch 'master' into defer-support
beerose 3b0cb04
Update test after merge
beerose 192fd04
Another approach to handling incremental not inlined fragments
beerose 6c79bad
Update examples
beerose be90ddc
Merge branch 'master' into defer-support
beerose 591d4d9
Fix emitLegacyCommonJSImports
beerose 9bfb3ea
Pass config to plugin
beerose 3e38d32
Fix import in example
beerose b0d6c20
Add preferred output
beerose 6e3a35d
Run updated codegen on examples
beerose bd2d527
Store deferred fields info on query metadata
beerose 64fa6ff
Traverse OperationDefinitionNode to find all deferred fields
beerose 5527846
Merge branch 'master' into defer-support
beerose 938eb57
Support string document mode with defer
beerose 4497d45
Don't import TypedDocumentNode in string mode
beerose d0b7a19
Fix typo
beerose 0e4fb55
Minor changes to the helper function
beerose 6ca5515
Fix typos
beerose 1f1a153
Merge branch 'master' into defer-support
beerose e8e2561
Update cypress version in new example
beerose 0376bf8
Add fragment name to __meta__ in string mode
beerose e434fe0
Merge branch 'master' into defer-support
beerose dda4daf
Update test
beerose 71cfe27
Improve isFragmentReady typings
beerose f1ffafd
Merge branch 'master' into defer-support
beerose 166708d
Use DocumentType in example
beerose ec9ac54
Merge branch 'master' into defer-support
beerose c13d589
Renegrate example after merging master
beerose e530d34
Update deps in new example
beerose b435f6d
Minor changes to defer related types
beerose 2cbe236
Add missing import
beerose c5d0247
Fix type
beerose bd97073
Update examples
beerose 1d451a8
Change isFragmentReady condition
beerose ce1e328
Merge branch 'master' into defer-support
beerose 82620d4
Merge branch 'master' into defer-support
beerose 8591cb8
Merge branch 'master' into defer-support
beerose 7af1241
Changeset
beerose ccdac2a
changeset 2
beerose 7ad08f5
Add docs
beerose File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,10 @@ | ||
--- | ||
'@graphql-codegen/typed-document-node': minor | ||
'@graphql-codegen/visitor-plugin-common': minor | ||
'@graphql-codegen/typescript-operations': minor | ||
'@graphql-codegen/typescript': minor | ||
'@graphql-codegen/typescript-resolvers': minor | ||
'@graphql-codegen/client-preset': minor | ||
--- | ||
|
||
Add `@defer` directive support |
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': patch | ||
--- | ||
|
||
Pass `emitLegacyCommonJSImports` and `isStringDocumentMode` to the client preset config |
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
While testing the release candidate which includes this PR, I realised that if an user has
noUncheckedIndexedAccess
turned on in theirtsconfig.son
, thefields
variable might be undefined, hence doingfields.length
orfields.every
fails and TS complains about it. Not sure how to fix this. Should I open an issue? Also apologies if this is not the place to comment about this.@beerose
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.
Thanks for the feedback! You can open an issue and I'll improve this function to work with noUncheckedIndexedAccess.
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.
Here: #9383. Thanks @beerose! I am happy to help testing this if needed. Cheers!
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.
Here's a fix: #9385
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.
Thanks!!