-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
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
- Go to
/readings - Click on
/ai - Actual: data still shows
/readings - 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
- Go to
/readings - Click on
/ai - Actual: data still shows
/readings - 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.2and later - The loader is being called but receives stale
params._splaton first navigation - The URL and
Route.useParams()update correctly, but the loader receives stale params - This affects any route that depends on
params._splatin 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.