Preventing Loaders from Re-running on Form Submission in Remix #10480
osowskimateusz97
started this conversation in
General
Replies: 1 comment 4 replies
-
You can export a shouldRevalidate function from your routes to control when that route should revalidate. Remix Docs: https://remix.run/docs/en/main/route/should-revalidate |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone,
I have a question about handling user preferences in a Remix app.
In my root.tsx, I have a sidebar that opens a modal. Inside this modal, there's a form where users can update their settings (e.g., language, date format). When a user updates these settings, I want to store them in a cookie so that they persist when they return. I'm using remix-i18next for internationalization.
However, when I submit the form, Remix automatically re-runs the loaders. In this case, I don’t want that to happen—I just want to send a POST request to update the cookie without triggering a full loader refresh.
For context, I’m using Remix with a Node server and React Router v7.
Any advice would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions