-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
"useSubmit
must be used within a data router" for 3rd party libraries on node 22.12.0
#12475
Comments
What is the best way to get this to work? I tried npm and overrides and patch-package but I get this error:
|
It worked for by downgrading to Node v22.11.0 |
I'm on v22.9.0 |
FWIW, I am facing a similar issue using Bun 1.1.40 + Clerk as mentioned in issue #12399. |
I was able to get around this. Not exactly sure what fixed it, but I removed remix from the project and reinstalled fresh, then moved all my routes/business logic back in and it started working again. |
The same issue occurs when you use React Router as a library together with the
|
After a considerable amount of investigation and testing, I had to migrate my project to the v7 router in various stages. You'll need to follow all the steps in this link: https://reactrouter.com/upgrading/remix For a useLocation problem, you need to install the react-router-dom library, which is not a direct react-router dependency (after multiple tests on my project). Hope this helps, I'm working on node v22.12. All my project's code is here: https://github.com/MrGlox/remix-nest-boilerplate it's a monorepo so look at the /apps/web folder. I'll switch all my useForm from @conform-to/react to remix-hook-form soon, but for now check the |
Thanks for sharing your findings. Unfortunately, I’ve already followed these steps, and the outcome hasn’t changed—the issue with useLocation still persists. It appears the migration doesn’t resolve the underlying problem in my case. |
@brookslybrand, here's a repro: https://github.com/MrAlex94/rr7-repro Using Bun
|
Have you added a new routes.ts file and updated remix() your vite.config.ts by reactRouter() ? Also added react-router.config.ts and updated entry.server with entry.client. The update / hydration part is really important because it change all the basic logic about routing in you project. |
renderToReadableStream wasn't working for me, I had to replace it by renderToPipeableStream in my case. Maybe think also to add a entry.client.tsx mainly with the hydrateRoot part. |
Hi! An issue was reported for RVF that I think might be related to this. There's a reproduction in this issue if that helps with diagnosing this one. The exact error message is different, but it looks like it could be the same root cause. It only happens on Node 22+ and is caused by calling a RR hook in a 3rd party library (RVF).
Since someone else mentioned Bun, I want to note that it also happens when using |
Any update on this? |
Hey folks - can anyone confirm if the change in #12708 fixes your issue? You should be able to just edit the |
It works! 😄 I have tested it with node 22.12, 22.13 and 23.6, where I was able to reproduce the issue without this. Just in case I also tested with node 22.10 to confirm it still works there as well. |
It works on our side (Clerk React Router SDK issue) too! Tested with multiple versions from Node 20 to 22.13 🚀 |
same here, the fix solves the issue for me 👍 |
I have a similar issue via airjp73/rvf#410, the solution that worked for me there is to lower the Vite version from 6.x to 5.x. Changing NodeJS and removing |
This fix works for me locally with the RVF issue. |
I've got a proposed fix for this in #12716. I've published it as Note that you'll also need to override your React Router version globally in {
// ...
"overrides": {
"react-router": "0.0.0-experimental-4d16b23b6"
}
} I've confirmed that this fixes the issue when reproducing via the steps @brookslybrand provided. |
@markdalgleish nice! This definitely solves the repo I had I did some testing with other reproductions, and it looks like this one now fails on Node 20 and earlier versions of Node 22 🫠 The instructions are pretty simple, and I've gone ahead and created a reproduction on StackBlitz. The only problem with StackBlitz is it's still stuck on node 18, but I have confirmed it's the same issue that's happening on Node 20 |
@markdalgleish can confirm that fixes our issue with our Clerk React Router SDK. Tried with Node v20, v22.11, v22.12, v22.13 "pnpm": {
"overrides": {
"react-router": "0.0.0-experimental-4d16b23b6"
}
} |
@markdalgleish Unlike the "manual" solution from @brophdawg11, react-router override with an experimental version did not seem to have an effect, still had the same issue 🤔 My issue is identical to airjp73/rvf#410 |
I've got a fix that works for both the original issue and airjp73/rvf#410. Turns out it's an issue with Vite not using the If you want to try it out, I've published another experimental release as |
Awesome! Thank you so much @markdalgleish, this seems to solve all of the issues I have been able to reproduce including the last one I provided (updated with new package) |
Unfortunately, the fix doesn't address the following conditions:
With Node 18.x (on Stackblitz) works. With Node 22.x it works until a custom server is used. Link to a lightly modified Stackblitz by @brookslybrand : https://stackblitz.com/edit/github-3pczvtze-izn4h9ox?file=server.ts,package.json Unfortunately there's no way to change Node.js version on Stackblitz |
Hmm, that's weird, thanks @OriginalEXE for pointing that out, I was able to reproduce. This seems to be something specific to using
|
I'm using React Router as a...
framework
Reproduction
This is the same issue as #12399 and #12401. It specifically breaks if you're using the latest version of Node 22 (22.12)
I can't use StackBlitz since it doesn't let me set the Node version, so here we go:
Use the latest node version
Note: If I use v22.9.0, I do not get this error 🙃
nvm use v22.12.0
setup a new template
npx create-react-router@latest -y
Add
remix-hook-form
npm i remix-hook-form
Call
useRemixForm
System Info
Used Package Manager
npm
Expected Behavior
It should work (see #12437 for initial fix)
Actual Behavior
It does not
The text was updated successfully, but these errors were encountered: