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

issues with generated file after react query v5 migration #9824

Open
dominikabieder opened this issue Jan 23, 2024 · 2 comments
Open

issues with generated file after react query v5 migration #9824

dominikabieder opened this issue Jan 23, 2024 · 2 comments

Comments

@dominikabieder
Copy link

dominikabieder commented Jan 23, 2024

Which packages are impacted by your issue?

@graphql-codegen/cli

Describe the bug

I'm having several issues after migrating tanstack query to v5. Is there anything I might have missed in the codegen.ts? how can I fix the warnings in generated.ts.

how do I pass options to the query? the app doesn't want to start due to bad argument type

const currentUserQuery = useCurrentUserQuery({ enabled: !isLoggingIn });
TS2322: Type boolean is not assignable to type never

Your Example Website or App

can't share

Steps to Reproduce the Bug or Issue

  1. upgrade react query

Expected behavior

no warnings in generated.ts and no issues with useQuery or useMutation hooks

Screenshots or Videos

image

const currentUserQuery = useCurrentUserQuery({ enabled: !isLoggingIn });
TS2322: Type boolean is not assignable to type never

Platform

  • OS: macOS
  • NodeJS: 18.18.2
  • graphql version: 16.8.1
  • @graphql-codegen/* version(s): [e.g. 2.6.2]
 "dependencies": {
    "@graphql-codegen/cli": "5.0.0",
    "@graphql-codegen/typescript-operations": "4.0.1",
    "@graphql-codegen/typescript-react-query": "6.0.0",
    "@graphql-eslint/eslint-plugin": "3.20.1",
    "@graphql-typed-document-node/core": "3.2.0",
    "@tanstack/eslint-plugin-query": "4.34.1",
    "@tanstack/react-query": "5.17.19",

Codegen Config File

import type { CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = {
  overwrite: true,
  schema: '../schema.graphql',
  reactQueryVersion: 5,
  documents: 'src/**/*.graphql',
  generates: {
    'src/generated/generated.ts': {
      plugins: ['typescript', 'typescript-operations', 'typescript-react-query'],
      config: {
        fetcher: '../fetcher#fetcher',
        namingConvention: {
          enumValues: 'keep',
        },
      },
    },
  },
};

export default config;

Additional context

No response

@U-4-E-A
Copy link

U-4-E-A commented Mar 1, 2024

With @tanstack/react-query v5, you need to specify your version in your codegen config: -

config: {
    reactQueryVersion: 5
}

@dominikabieder
Copy link
Author

With @tanstack/react-query v5, you need to specify your version in your codegen config: -

config: {
    reactQueryVersion: 5
}

I have that :( fixed the formatting so it's more visible

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

No branches or pull requests

2 participants