Skip to content

beforeLoad doesn't get called #1752

@nucleartux

Description

@nucleartux

Describe the bug

I expect that every every time I enter the route beforeLoad will be called

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-94bxv9?file=src%2Froutes%2F_auth.tsx

Steps to Reproduce the Bug or Issue

  1. Click "Go to the auth-only invoices page".
  2. Enter any login and access the authorized part of the site.
  3. Quickly click "Logout".
  4. Quickly click "Go to the auth-only invoices page" again.
  5. You are on the "Invoices" page without any authentication.

(You may need a few tries.)

Expected behavior

On Step 4, loading happens again, and I'm redirected to the login page.

Screenshots or Videos

No response

Platform

    "@tanstack/react-router": "^1.36.3",
    "@tanstack/router-devtools": "^1.36.3",
    "@tanstack/router-vite-plugin": "^1.38.0",

Additional context

If it's expected behavior, how can I avoid it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions