-
Say I'm at URL There's a I added a hidden <input name="redirectTo" type="hidden" value={useLocation().pathname} /> In order to return the proper export const action: ActionFunction = async ({ request }) => {
// ...
return redirect((await request.formData()).get("redirectTo"));
}; Is there a better way? Seems a lot of stuff just to say "don't do anything". Plus, I noticed that the URL does change for a fraction of a second ( |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Could this be of help? https://remix.run/docs/en/v1.5.1/api/remix#usesubmit |
Beta Was this translation helpful? Give feedback.
-
There are at least three patterns I found for this.
I think the third is the simplest, but because the browser may not send the header if the user configured a higher security or you used noreferer the second is the safest. That said, if you move the action to the route with the Form this will not be an issue anymore, the URL change will also not happen. And the reason the URL change from It doesn't happen with |
Beta Was this translation helpful? Give feedback.
There are at least three patterns I found for this.
I think the third is the simplest, but because the browser may not send the header if the user configured a higher security or you used noreferer the second is the safest.
That said, if you move the action to the route with the Form this will not be an issue anymore, the URL change will also not happen.
And the reason the URL change from
/sales/invoices/102000
to/sales
to/sales/invoices/102000
is because a Form does a navigation, it navigate…