Skip to content

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

@jrestall

Description

@jrestall

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions