Skip to content
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

Nested fragments do not work with client-preset and documentMode="string" #9356

Open
stefanoverna opened this issue Apr 28, 2023 · 0 comments
Assignees
Labels
kind/bug Bug :-( stage/1-reproduction A reproduction exists

Comments

@stefanoverna
Copy link

stefanoverna commented Apr 28, 2023

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

@saihaj saihaj added stage/1-reproduction A reproduction exists kind/bug Bug :-( labels May 12, 2023
@beerose beerose self-assigned this May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Bug :-( stage/1-reproduction A reproduction exists
Projects
None yet
Development

No branches or pull requests

3 participants