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

Support react 19 #1448

Open
lu-perfect opened this issue Dec 12, 2024 · 6 comments
Open

Support react 19 #1448

lu-perfect opened this issue Dec 12, 2024 · 6 comments
Labels
enhancement New feature or request @kubb/react

Comments

@lu-perfect
Copy link

lu-perfect commented Dec 12, 2024

What is the problem this feature would solve?

Support react 19

External documents/projects?

No response

What is the feature you are proposing to solve the problem?

No response

What alternatives have you considered?

No response

@lu-perfect lu-perfect added the enhancement New feature or request label Dec 12, 2024
Copy link

linear bot commented Dec 12, 2024

KUBB-85 Support react 19

@stijnvanhulle
Copy link
Collaborator

@lu-perfect I had a try with the latest Kubb version(3.3.0, react-query and React 19), seems to work fine here. See https://www.kubb.dev/examples/tanstack-query/react-query

@Rikard-Johansson97
Copy link

@lu-perfect I had a try with the latest Kubb version(3.3.0, react-query and React 19), seems to work fine here. See https://www.kubb.dev/examples/tanstack-query/react-query

I get validation error when its running the 2/5 | plugin-oas: buildStart

ERROR Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
    See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem. (repeated 2361 times)

@stijnvanhulle
Copy link
Collaborator

@Rikard-Johansson97 Could you provide me an example project or your package.json/kubb.config.ts?

@geirsagberg
Copy link

I am also getting an error:

Cannot read properties of undefined (reading 'ReactCurrentOwner')

    at $$$reconciler (node_modules/react-reconciler/cjs/react-reconciler.development.js:491:46)
    at node_modules/@kubb/react/src/kubbRenderer.ts:75:3
    at import (node_modules/jiti/dist/jiti.cjs:1:199710)
    at node_modules/@kubb/plugin-oas/dist/chunk-BAU7PO7T.js:1:195
    at import (node_modules/jiti/dist/jiti.cjs:1:199710)
    at node_modules/@kubb/plugin-oas/dist/chunk-WBHFV7C2.js:1:256
    at import (node_modules/jiti/dist/jiti.cjs:1:199710)
    at node_modules/@kubb/plugin-oas/dist/index.js:2:21
    at import (node_modules/jiti/dist/jiti.cjs:1:199710)
    at kubb.config.ts:2:18
    at Function.import (node_modules/jiti/dist/jiti.cjs:1:199710)
    at tsLoader (node_modules/@kubb/cli/src/utils/getCosmiConfig.ts:21:15)
    at Explorer.#loadConfiguration (node_modules/cosmiconfig/src/Explorer.ts:160:30)
    at Explorer.#loadConfigFileWithImports (node_modules/cosmiconfig/src/Explorer.ts:114:27)
    at Explorer.#readConfiguration (node_modules/cosmiconfig/src/Explorer.ts:105:7)
    at search (node_modules/cosmiconfig/src/Explorer.ts:61:28)
    at Explorer.search (node_modules/cosmiconfig/src/Explorer.ts:95:12)
    at getCosmiConfig (node_modules/@kubb/cli/src/utils/getCosmiConfig.ts:60:57)
    at Object.run (node_modules/@kubb/cli/src/commands/generate.ts:81:20)
    at runCommand (node_modules/citty/dist/index.mjs:316:16)
    at runCommand (node_modules/citty/dist/index.mjs:307:11)
    at runMain (node_modules/citty/dist/index.mjs:445:7)
    at run (node_modules/@kubb/cli/src/index.ts:49:3) 

Relates to this line in react-reconciler:

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

This has been renamed in React 19. Can be fixed like this: https://github.com/microsoft/use-disposable/pull/32/files#diff-5971f63da29997ff64996c0f14497c4756ed24cf15d181141ea6a8f9c8d7a376R6, in react-reconciler

@geirsagberg
Copy link

Seems to have been fixed in latest version of react-reconciler. So @kubb/react should probably update their version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request @kubb/react
Projects
None yet
Development

No branches or pull requests

4 participants