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 · 4 comments
Closed
Assignees
Labels
awaiting release This issue has been fixed and will be released soon bug feat:router pkg:react-router

Comments

@gatzjames
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting release This issue has been fixed and will be released soon bug feat:router pkg:react-router
Projects
None yet
Development

No branches or pull requests

5 participants