Skip to content

Fix fetcher state stuck on loading if a loader redirects #12873

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

Merged
merged 7 commits into from
May 1, 2025

Conversation

gatzjames
Copy link

@gatzjames gatzjames commented Jan 27, 2025

Fixes #11235

Overview

When a fetcher.submit(...) triggers a loader revalidation that redirects, the fetcher state never gets updated and gets stuck in loading.
This PR uses the existing logic to reset the fetcher state before we return in either loader redirects or fetcher redirects

  • Added an integration test that initially fails and then passes with the current changes
    • Should this PR also include some jest tests?
  • All other tests passed locally but not sure if this change affects other pieces of if there are edge cases I should handle
  • If this is the way should this fix be backported to v6 too?

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jan 27, 2025

Hi @gatzjames,

Welcome, and thank you for contributing to React Router!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

Copy link

changeset-bot bot commented Jan 27, 2025

🦋 Changeset detected

Latest commit: ce7c215

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
react-router Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/dev Patch
react-router-dom Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
create-react-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jan 27, 2025

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@gatzjames
Copy link
Author

Hi team 👋, was wondering if there's anything I can do to help move this forward or if it's not something that should be fixed in this way.

@timdorr timdorr requested a review from brophdawg11 March 22, 2025 21:49
@brophdawg11
Copy link
Contributor

Thanks @gatzjames! You had the fix right - I just lifted the logic up a bit and added a more streamlined unit test to avoid the e2e overhead.

@brophdawg11
Copy link
Contributor

If this is the way should this fix be backported to v6 too?

We're only currently planning on backporting security fixes and fixes to future flag behavior that would prevent a v6 app from upgrading to v7. Normal bug fixes such as this land only in v7 and the fix for apps is to upgrade from v6.

@brophdawg11 brophdawg11 merged commit 26ecf2f into remix-run:dev May 1, 2025
5 checks passed
@gatzjames
Copy link
Author

Thanks @gatzjames! You had the fix right - I just lifted the logic up a bit and added a more streamlined unit test to avoid the e2e overhead.

Awesome 👏
Thanks for cleaning up the code and updating the tests!
Happy to contribute you are doing amazing work with react-router 🙏

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

Successfully merging this pull request may close these issues.

2 participants