Skip to content

SPA mode: Page gets rendered even if we redirect in clientLoaderΒ #13074

@aron51

Description

@aron51

I'm using React Router as a...

framework

Reproduction

https://stackblitz.com/edit/github-vapjjyhs?file=app%2Froutes%2Fhome.tsx

Using new version v7.2.0, the page gets rendered even if we return or throw a redirect in the clientLoader. See that there is an error in the console as the Home page tries to read the loader data.

This was working in previous versions.

System Info

System:
    OS: macOS 15.0.1
    CPU: (8) arm64 Apple M1
    Memory: 85.89 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.7.0 - /opt/homebrew/bin/node
    npm: 10.9.2 - /opt/homebrew/bin/npm
    pnpm: 10.1.0 - /opt/homebrew/bin/pnpm
    bun: 1.1.38 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 133.0.6943.99
    Safari: 18.0.1

Used Package Manager

npm

Expected Behavior

If a redirect is returned/thrown in the clientLoader the page doesn't get rendered.

Actual Behavior

If a redirect is returned/thrown in the clientLoader the page gets rendered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions