Skip to content

beforeLoad adds ~400ms delay on page reload #2183

@cschmatzler

Description

@cschmatzler

Describe the bug

When adding beforeLoad to a route (even an empty one), the router gets mounted and then displays a white page for approx. 400ms before the actual page is rendered.

Your Example Website or App

https://stackblitz.com/github/tanstack/router/tree/main/examples/react/quickstart-file-based

Steps to Reproduce the Bug or Issue

  1. Fork the file-based QuickStart example on StackBlitz.
  2. Add an beforeLoad: () => {} to any page - I chose the about page.
  3. Go to the page you changed and reload the page in the browser.

Expected behavior

Simply adding the beforeLoad option should not materially change load times.

Screenshots or Videos

router.mp4

Platform

  • OS: macOS Sonoma
  • Browser: Arc
  • Version: 1.56.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions