-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Comments
@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:
|
@Rikard-Johansson97 Could you provide me an example project or your package.json/kubb.config.ts? |
I am also getting an error:
Relates to this line in
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 |
Seems to have been fixed in latest version of react-reconciler. So |
It does not seems to be exclusively realted to the TanstackQuery plugin, because I have the same issue even if I remove |
Environment:
Configuration: import { defineConfig } 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";
import { pluginZod } from "@kubb/plugin-zod";
export default defineConfig({
input: {
path: `${process.env.NEXT_PUBLIC_API_URL}/swagger/v1/swagger.json`,
},
root: ".",
name: "@ssil/generated",
output: {
path: "./src",
write: true,
clean: true,
extension: undefined,
barrelType: "named",
},
hooks: {
done: ["pnpm turbo run format --force --continue -- --write"],
},
plugins: [
pluginOas({ validate: true }),
pluginTs({
unknownType: "unknown",
enumSuffix: "",
transformers: {
name: (name) => `${name}Type`,
},
}),
pluginClient({
importPath: "@ssil/client/socio",
pathParamsType: "object",
}),
pluginReactQuery({
client: {
dataReturnType: "data",
importPath: "@ssil/client/socio",
},
suspense: {},
}),
pluginZod({
unknownType: "unknown",
coercion: true,
typed: true,
}),
],
}); Problem:
Temporary Fix: "pnpm": {
"overrides": {
"react": "18.2.0",
"react-dom": "18.2.0"
}
} |
@Rikard-Johansson97 I tried with your settings here but without any issues, see https://github.com/kubb-labs/test-next-15. Could you point me to what is different between my test and your project? |
It's only see a plain next-15 project. Have you uncommitted changes? |
@Rikard-Johansson97 yes indeed, forgot to push latest changes |
Any update on this issue ? We still haven't found a way to make Kubb work in a React 19 project |
@obrassard Can you provide me some information about your setup or a playground for it? I have next 15 with React 19 test done that worked fine + React 19 with vite was also working fine. So trying to see what kind of difference there is with other projects. |
Hi @stijnvanhulle, thank you for you fast answer. I've made more tests and I realized that the behaviour was different whether we use When using bun
I have the following error that I had not in react 18 projects : When using npm
I have a different error, that doesn't seem to be related to React ![]() All
|
@obrassard Not sure if this is related to Bun but I already see that you are using Kubb v2 and Kubb v3 together which is something that will result in random errors. Can you try updating all packages that uses |
@stijnvanhulle Oh my, I don't know how I missed this! I modified my dependencies and adapted the configuration. Now when installing with NPM everything works as expected. However, if I install the packages with Bun I get the same error message ( |
Same problem using bun: |
@stijnvanhulle Any update on the Bun issue? Is there something I can do to help further diagnose this issue? |
@obrassard Do you have a playground/Codesandbox? I tried locally myself with Bun and no issues found so need to see if something else is making Kubb crash. |
@stijnvanhulle Had you tried with this repo ? Everytime I try running those command I can reproduce the error easily :
If you cannot reproduce it on your side with this repo, let me know and I'll try to reproduce it in an online playground, however the one I know doesn't support bun out of the box |
@obrassard I have a solution that will be fixed in version Issue: Bun does not respect the same node_modules structure as other package managers. They try to be smarter with caching which results in Kubb using the main React version instead of the custom one we specify in |
Thank you @stijnvanhulle ! |
@stijnvanhulle I can confirm that v3.5.10 works with my Turborepo (pnpm workspace), Next.js (v15.1.7), and React (v19). Thanks! 😊 |
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
The text was updated successfully, but these errors were encountered: