Preventing Loaders from Re-running on Form Submission in Remix #10480
Replies: 2 comments 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.
-
So, if I make a small update - like changing a user's setting from a modal that could be opened on top of any page, I’m supposed to add |
Beta Was this translation helpful? Give feedback.
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