-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
[Bug]: useActionData return wrong data after redirection from action #9333
Comments
actionData in router state seems to not being reset when redirection is trigger from an action. |
Merged and should be available in 6.4.2 - hopefully released this week 👍 |
👍 Thanks @brophdawg11 ! |
Looks like that #9334 hasn't completely fixed this issue 🤔 ContextI have an action that returns an error if there's an error or return a redirect if everything is fine:
If we submit invalid data, What version of React Router are you using?
|
@BaggioGiacomo Can I ask why you're doing a redirect if the intention is to stay at the same location? I think |
@brophdawg11 We're trying to stick with the same approach that we'd use in Remix. To enable progressive enhancement aren't we supposed to redirect after a |
Ah, ok - yeah generally that's the recommended approach, but I don't think you technically need to do that if it's to the current location, because that's what the browser would do without JS in the first place (reload the entire page at the form action location). That being said, I do think it's probably a bug and |
This should have been fixed by the above PR :) |
Thanks! @brophdawg11 💪🏻 |
What version of React Router are you using?
6.4.1
Steps to Reproduce
Pull this repository: https://github.com/jrakotoharisoa/react-router-sandbox
Expected Behavior
On the redirecting page, action data should be null
Actual Behavior
Action data on the redirecting page correspond to old action data returned when the form on previous page was in error.
The text was updated successfully, but these errors were encountered: