-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
Description
Which packages are impacted by your issue?
@graphql-codegen/client-preset
Describe the bug
When using documentMode: "string"
with @graphql-codegen/client-preset, in case of nested fragments, only the first level of fragments are included in the final query.
The Github repo reproduces the issue clearly.
Your Example Website or App
https://github.com/stefanoverna/codegen-string-bug
Steps to Reproduce the Bug or Issue
yarn
yarn start
Notice that the output on the page is just:
query Video($id: ID!) {
video(id: $id) {
...DetailsFragment
__typename
}
}
fragment DetailsFragment on Video {
title
__typename
...MovieFragment
...EpisodeFragment
}
So, MovieFragment and EpisodeFragment are missing.
Expected behavior
MovieFragment
and EpisodeFragment
should be part of the query.
Screenshots or Videos
No response
Platform
- OS: macOs
- NodeJS: 16.20.0
graphql
version: 16.6.0@graphql-codegen/client-preset
version: 3.0.1
Codegen Config File
import { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
schema: "schema.graphql",
documents: ["src/**/*.tsx", "!src/gql/**/*"],
generates: {
"./src/gql/": {
preset: "client",
plugins: [],
config: { documentMode: "string" },
presetConfig: {
fragmentMasking: { unmaskFunctionName: "getFragmentData" },
},
},
},
};
export default config;
Additional context
No response
chanceaclark, deini, leniency and viktordanko