Skip to content

[Bug]: Redirect on loader causes action fetcher state to be stuck in 'loading' #11235

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

Closed
gatzjames opened this issue Jan 30, 2024 · 6 comments
Closed

Comments

@gatzjames
Copy link
Contributor

gatzjames commented Jan 30, 2024

What version of React Router are you using?

Tested on 6.21.3 and 7.1.3

Steps to Reproduce

  • Create a loader that redirects to another path if some resource doesn't exist e.g. /product/:id
  • Create a fetcher that calls an action that deletes the resource
  • Navigate to /product/:id and call the fetcher that deletes the resource.
  • The fetcher is stuck in a 'loading' state

Example codesandbox with reproduction of the issue

Expected Behavior

The fetcher that calls the action should have a state of 'idle' when everything is completed.

Actual Behavior

The fetcher is stuck in a 'loading' state

@gatzjames gatzjames added the bug label Jan 30, 2024
@wolthers
Copy link

wolthers commented Apr 8, 2024

Here's another reproduction that I think is the same issue in Remix: https://stackblitz.com/edit/remix-run-remix-gslrhe

@jarredwitt
Copy link

Ran into this as well. I found a workaround using redirectDocument. Not the best, but at least produces a somewhat correct behavior in the end.

@KostarSf
Copy link

KostarSf commented Jan 28, 2025

Same issue. I use <Form /> without fetcher for actions that make redirects as a workaround

@brophdawg11
Copy link
Contributor

Resolved by #12873 and will be available in the next release. Thanks for the contribution @gatzjames! 🙌

@brophdawg11 brophdawg11 added the awaiting release This issue has been fixed and will be released soon label May 1, 2025
Copy link
Contributor

github-actions bot commented May 8, 2025

🤖 Hello there,

We just published version 7.6.0 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions github-actions bot removed the awaiting release This issue has been fixed and will be released soon label May 8, 2025
Copy link
Contributor

🤖 Hello there,

We just published version 7.6.1 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants