Skip to content

Loader receives stale params._splat on first navigation with splat routes #6452

@thuillart

Description

@thuillart

Which project does this relate to?

Router

Describe the bug

When using a splat route (/$) with params._splat, navigating between routes requires two clicks to update the loader data. On the first click, the URL updates correctly but the loader runs with stale params._splat from the previous route, causing Route.useLoaderData() to return data for the wrong route.

Your Example Website or App

https://github.com/thuillart/site.git

Steps to Reproduce the Bug or Issue

  1. Go to /readings
  2. Click on /ai
  3. Actual: data still shows /readings
  4. Click again → data shows /ai

Expected behavior

As a user, I expected: When I click a link to navigate from /docs/a to /docs/b, the page should immediately show the content for /docs/b with the correct loader data.

But I am seeing: When I click a link to navigate from /docs/a to /docs/b, the URL updates to /docs/b but the page still displays content from /docs/a. I need to click the link a second time (or navigate to another route) before the correct content for /docs/b appears.

Screenshots or Videos

  1. Go to /readings
  2. Click on /ai
  3. Actual: data still shows /readings
  4. Click again → data shows /ai

Platform

  • Router / Start Version: 1.154.7
  • OS: macOS
  • Browser: Chrome
  • Browser Version: 144.0.7559.60
  • Bundler: vite
  • Bundler Version: 7.3.1

Additional context

  • Works correctly in @tanstack/react-router@1.153.1
  • Broken in @tanstack/react-router@1.153.2 and later
  • The loader is being called but receives stale params._splat on first navigation
  • The URL and Route.useParams() update correctly, but the loader receives stale params
  • This affects any route that depends on params._splat in the loader

I also opened an issue in Fumadocs where it was determined this is likely a TanStack Router issue rather than a Fumadocs issue.

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