router
router copied to clipboard
Route match warnings (start/alpha)
Which project does this relate to?
Start
Describe the bug
Under certain conditions, routes with dynamic parameters are logging match warnings when links are clicked.
This is reproduced in the start-basic example upgraded to the alpha release
posts.$postId.tsx:47 Could not find match for from: /posts/$postId
posts.$postId.tsx
47: <Link
to="/posts/$postId/deep"
params={{
postId: post.id,
}}
activeProps={{ className: "text-black font-bold" }}
className="inline-block py-1 text-blue-800 hover:text-blue-600"
>
Deep View
</Link>
Your Example Website or App
https://github.com/danecando/start-basic
Steps to Reproduce the Bug or Issue
- Start the alpha/devinxi start-basic example
- Navigate to
/posts - Click a link for one of the posts in the list
- Click the "Deep View" link in the post page
After clicking "Deep View" route match warning gets logged to the console
Expected behavior
As a user, I expect to be able to link to full paths in my route tree without console warnings
Screenshots or Videos
No response
Platform
- OS: MacOS Sequoia 15.5
- Browser: Chrome
- Version: 136
Additional context
Confirmed that this issue cannot be reproduced in the main branch start-basic example or regular router basic examples
I’m experiencing the same issue starting with the latest version 1.121.0.
I see this issue as well:
Could not find match for from: /codelist/$code/
but I have route like this working well:
createFileRoute('/codelist/$code/')
I am using file routes.
Also seeing this issue but it errors me back to the parent element
I'm getting the same issue after having to manually delete my node modules and then npm install. I'm also getting a .tanstack/temp/router-generator-xyz folder being created with every npm run dev. The warnings seem to be related to the Link component. The routing works well with no issues. It is just these folders and the console warnings. I'm using file based routing (the router only not Start). It seems that auto-code splitting is also affected. previously I had 100+ chunks, now it is just 8.
Getting this issue also after upgrading to the latest.
I am getting this warning after upgrading router to 1.121.12
not using start.
Could not find match for from: /pathname/
Also this seems to be happening with when navigating from basic routes to routes with dynamic params or vice versa. Navigating between two basic routes without any params, does not log the warning 🤔
Also this seems to be happening with when navigating from basic routes to routes with dynamic params or vice versa. Navigating between two basic routes without any params, does not log the warning 🤔
This is what I am seeing as well. Navigating to and away from a route that has params (no problem with searchParams) gives this warning. It does not matter whether navigating by Link, through useNavigate or via browser back/forward.
Providing a from in the link does not help.
Nothing seems to be "broken", but the warnings are annoying and they give me the feeling something might not be working.
This problem has started since 1.121, I am using file based routing and not using Start but simple Vite config.
Having the same issue on 1.121.21
There might be something wrong with router.matchRoute.
Starting with version v1.21.x, useMatchRoute (which uses router.matchRoute) returns different results.
After (at least) five hours of debugging, I can say this router.matchRoute change is kinda breaking.
In our app (React SPA + Tanstack Router), some routes don't have .index files to determine the index of that route. Everything worked just fine up until 1.120.20.
After updating to the latest, out of nowhere, some routes were just being redirected to the root index (/). I thought it was a change in our code, and I have been trying to debug it ever since. After reading about this issue and downgrading to 1.120.20, the problem went away.
Even though it was a "minor update," it would be considered a breaking change that I wasn't aware of.
@mathwcst-bitlyft can you please provide a reproducer for this? we did not intend to introduce any change here, so this is a bug then
Sorry for the delay, I've been super overwhelmed at work. I will create the reproducer this weekend and update here.
Can confirm that the issue does not appear in version 1.120.00.
I also got the issue on a renovate PR, no Start, only Router, upgrading 1.120.17 -> 1.121.21
It is easy to reproduce, just follow the Quick Start (https://tanstack.com/router/latest/docs/framework/react/quick-start#manual-setup), and add a Link component to about.tsx, then click the link you will see the warning in console
We're encountering the same issue when upgrading from version 1.120.20 to >=1.121.0.
After debugging the router.ts file—specifically the section where the warning is logged—we noticed that this.latestLocation gets updated to the target location, while dest still retains a reference to the previous state. This mismatch causes the issue.
In the screenshot, you can see that dest correctly contains the expected to and from values. However, this.currentLocation has already been updated to the new destination. As a result, allFromMatches no longer includes the intended match, which leads to the warning being triggered.
issue as of 1.125.6