Skip to content

Breaking change in the last @tanstack/react-query version #1790

@vitorcamachoo

Description

@vitorcamachoo

What version of kubb is running?

3.5.13

What kind of platform do you use?

None

Your kubb.config.ts config file?

import { defineConfig, type UserConfig } from '@kubb/core';
import { pluginClient } from '@kubb/plugin-client';
import { pluginOas } from '@kubb/plugin-oas';
import { pluginReactQuery } from '@kubb/plugin-react-query';
import { pluginTs } from '@kubb/plugin-ts';

export default defineConfig({
  input: {
    path: './schema.yaml',
  },
  output: {
    extension: { '.ts': '' },
    clean: true,
    path: './src',
  },
  plugins: [
    pluginOas({
      validate: true,
      // @ts-ignore
      output: false,
    }),
    pluginTs({
      output: {
        path: './types',
        banner: `
          /**
           * Generated by kubb.
           * Do not edit manually.
           * Shape API
           */        
        `,
      },
      exclude: [],
      enumType: 'asConst',
      enumSuffix: 'Enum',
      dateType: 'string',
      unknownType: 'unknown', // @todo: change to 'void' after https://github.com/kubb-labs/kubb/pull/1577
      optionalType: 'questionToken',
      oasType: false,
      transformers: {
        name: (name, type) => {
          if (type === 'file') return `${name[0].toLowerCase() + name.slice(1)}Schema`;
          return `${name}Schema`;
        },
      },
    }),
    pluginClient({
      importPath: '../../client',
      output: {
        path: './api/index.ts',
        barrelType: 'propagate',
        banner: `
          /**
           * Generated by kubb.
           * Do not edit manually.
           * Shape API
           */        
        `,
      },
    }),
    pluginReactQuery({
      client: {
        importPath: '../../client',
      },
      output: {
        path: './hooks/index.ts',
        banner: `
          /**
           * Generated by kubb.
           * Do not edit manually.
           * Shape API
           */        
        `,
      },
      paramsCasing: 'camelcase',
      suspense: {},
    }),
  ],
}) as UserConfig;

Swagger/OpenAPI file?

What version of external packages are you using(@tanstack-query, MSW, React, Vue, ...)

"@tanstack/react-query": "5.81.5"
"@kubb/cli": "3.5.13",
    "@kubb/core": "3.5.13",
    "@kubb/plugin-oas": "3.5.13",
    "@kubb/plugin-react-query": "3.5.13",
    "@kubb/plugin-ts": "3.5.13",

What steps can reproduce the bug?

After upgrading @tanstack/react-query from 5.52.1 to 5.81.5, the infinite query options started returning a different type, as you can see in the following screenshots:

Before(correct):
Image

After:
Image

I believe it may be related to this implementation from tanstack side:
TanStack/query#9030

How often does this bug happen?

None

What is the expected behaviour?

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions