-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Which packages are impacted by your issue?
@graphql-codegen/client-preset
Describe the bug
When using isFragmentReady function with a fragment that has a deferred nested fragment, the function returns only true, this is related to the fact that __meta__.deferredFields is not populated on fragments, but only on queries.
e.g.
//@ts-ignore
const Fragment = gql(/* GraphQL */ `
fragment Foo on Foo {
value
}
`);
//@ts-ignore
const NestedFragmentWithFragment = gql(/* GraphQL */ `
fragment fooNested on Foo {
id
...foo @defer
}
`);Your Example Website or App
https://github.com/ludusrusso/example-gql-codegen-with-fragment-deferred
Steps to Reproduce the Bug or Issue
- Create a fragment
- Use the fragment in other fragment with @defer
- use
isFragmentReadyfunction, it will always return true
Expected behavior
isFragmentReady should return false if the nested deferred fragment is not ready.
Screenshots or Videos
No response
Platform
- OS: macOS
- NodeJS: 18.5.0
graphql16.6.0@graphql-codegen/*^4.0.1
Codegen Config File
// eslint-disable-next-line import/no-extraneous-dependencies
import { type CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: './src/yoga.mjs',
documents: ['src/**/*.tsx'],
generates: {
'./src/gql/': {
preset: 'client',
},
},
hooks: { afterAllFileWrite: ['prettier --write'] },
};
export default config;Additional context
Example repo: https://github.com/ludusrusso/example-gql-codegen-with-fragment-deferred
n1ru4l
Metadata
Metadata
Assignees
Labels
No labels