Skip to content

[7.5.1] throwing error in action clears root loader data #13474

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
jrestall opened this issue Apr 28, 2025 · 8 comments · Fixed by #13476
Closed

[7.5.1] throwing error in action clears root loader data #13474

jrestall opened this issue Apr 28, 2025 · 8 comments · Fixed by #13476

Comments

@jrestall
Copy link
Contributor

jrestall commented Apr 28, 2025

I'm using React Router as a...

framework

Reproduction

  1. Go to https://stackblitz.com/github/jrestall/react-router-bug/tree/main?file=README.md
  2. Open site and get automatically redirected to /login for your convenience.
  3. Note that the root loader data myData is Hello.
  4. Click 'submit', note that myData is empty.
  5. Install react-router 7.5.0 instead and reload site and steps.
  6. Note that the root loader data is not cleared when a error is thrown.

System Info

System:
    OS: macOS 11.7.10
    CPU: (8) x64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
    Memory: 187.81 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 21.1.0 - /usr/local/bin/node
    Yarn: 1.22.13 - /usr/local/bin/yarn
    npm: 10.2.0 - /usr/local/bin/npm
    pnpm: 10.6.1 - ~/Library/pnpm/pnpm
  Browsers:
    Brave Browser: 133.1.75.175
    Chrome: 135.0.7049.115
    Safari: 16.6.1
  npmPackages:
    @react-router/dev: 7.5.1 => 7.5.1 
    @react-router/node: 7.5.1 => 7.5.1 
    @react-router/serve: 7.5.1 => 7.5.1 
    react-router: 7.5.1 => 7.5.1 
    vite: ^5.4.11 => 5.4.18

Used Package Manager

npm

Expected Behavior

The root loader data isn't cleared when an action throws an error and is available in the root error boundary. 7.5.0 behavior.

Actual Behavior

In 7.5.1 the root loader data is cleared on a thrown action error and is not accessible from the root error boundary.

@brophdawg11
Copy link
Contributor

This is resolved via #13476 and should be fixed in the next release - aiming for a prerelease this afternoon and a stable either EOD or tomorrow AM

@brophdawg11 brophdawg11 removed their assignment Apr 28, 2025
@brophdawg11 brophdawg11 added the awaiting release This issue has been fixed and will be released soon label Apr 28, 2025
Copy link
Contributor

🤖 Hello there,

We just published version 7.5.3-pre.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!

Copy link
Contributor

🤖 Hello there,

We just published version 7.5.3 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!

@AntonOfTheWoods
Copy link

@brophdawg11 my issue with 7.5.0 -> 7.5.1 (raised on Discord) seems to also be fixed with this release - coincidence or likely the same reason (I'm interested because it might reappear otherwise...)?

@brophdawg11
Copy link
Contributor

Can you link me to the discord issue?

@AntonOfTheWoods
Copy link

@brophdawg11
Copy link
Contributor

@AntonOfTheWoods This fix shouldn't have impacted your issue. My guess is you had a weird combination of 7.5.0/7.5.1 in your node_modules causing duplicate copies of react-router and thus duplicate React contexts and your install of 7.5.3 cleared that up.

@AntonOfTheWoods
Copy link

Thanks. I did spend a significant amount of time verifying that I had exactly one version of react-router(-dom) throughout the workspace but maybe I missed something. Such are the joys of JS.

@brophdawg11 brophdawg11 removed the awaiting release This issue has been fixed and will be released soon label May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants