Skip to content

onEnter doesn't wait for route to be "loaded" #3293

Description

@KubaJastrz

Which project does this relate to?

Router

Describe the bug

onEnter doesn't wait for route to be "loaded" as described in the documentation, as it sometimes runs in parallel to loader function.

If this is expected behavior, I'd love for the documentation to be more precise.

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-cvkdwp2k?file=src%2Froutes%2Fabout.tsx,src%2Froutes%2Findex.tsx

Steps to Reproduce the Bug or Issue

Try this a couple of times, I got varied results by repeating the steps.

  1. Open console
  2. Be on /
  3. Go to /about via navbar
  4. -- sometimes onEnter starts after loader, but sometimes is starts in parallel to beforeLoad and loader
    Image
  5. Refresh /about
  6. -- onEnter always starts in parallel to beforeLoad
    Image

Expected behavior

onEnter always starts after loader finishes

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: 132

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions