Skip to content

fix(typescript-react-query): honor plainString document mode - #1749

Open
dohomi wants to merge 1 commit into
dotansimha:mainfrom
dohomi:codex/react-query-plain-string
Open

dohomi wants to merge 1 commit into
dotansimha:mainfrom
dohomi:codex/react-query-plain-string

Conversation

@dohomi

@dohomi dohomi commented Nov 27, 2026

Copy link
Copy Markdown

Description

The React Query visitor forces string mode, which wraps each document in a TypedDocumentString. This prevents users from passing generated documents directly to custom fetchers that accept a primitive string, even when they explicitly select plainString.

Honor the explicit plainString setting for operations and fragments. Generate the wrapper and its type import only when needed, and use a string parameter in the built-in fetchers for plain documents. The default continues to generate typed documents.

Related #1410

Type of change

  • Bug fix
  • Patch changeset included

Verification

Run pnpm exec vitest run --project typescript-react-query. All 46 tests pass. The six new cases cover the default fetcher, a fixed endpoint, both graphql-request client configurations, a custom fetcher, and fragment-only output. Existing snapshots pass as written.

Also checked TypeScript and ESLint in the upstream workspace on Node.js 24.14.0.

@changeset-bot

changeset-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4dae1f6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-codegen/typescript-react-query Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant