Skip to content
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

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

Open
aron51 opened this issue Feb 20, 2025 · 1 comment
Open

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

aron51 opened this issue Feb 20, 2025 · 1 comment
Labels

Comments

@aron51
Copy link

aron51 commented Feb 20, 2025

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.

@aron51 aron51 added the bug label Feb 20, 2025
@itsthekeming
Copy link

Seeing this as well with 7.2.0 with SPA mode. It's working as expected on 7.1.5. We redirect from our index route if the user is authenticated and we're getting a flash of that route before it redirects, as though the app isn't waiting for the index's clientLoader to finish before rendering.

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

No branches or pull requests

2 participants