Closed samgqroberts closed 9 months ago
can you please provide a complete example by forking the existing stackblitz and applying the steps you described?
@schiller-manuel Sorry, not familiar with Stackblitz, didn't realize it was that easy. Tell me if this works for you: https://stackblitz.com/edit/tanstack-router-fwxnpz?file=src%2Froutes%2F__root.tsx. You should see matchRoute result: false
in the rendered output, which is the bug - it should be matchRoute result: {}
I believe
@schiller-manuel Thank you for the very quick turnaround! I'll confirm the fix once a new version of @tanstack/react-router has been published with this fix
was already released
Confirmed in my project! Thank you @schiller-manuel
Describe the bug
useMatchRoute() seems to always return
false
when the router and vite are configured to have a basepath.Your Example Website or App
https://stackblitz.com/github/tanstack/router/tree/main/examples/react/basic-file-based?embed=1&theme=light
Steps to Reproduce the Bug or Issue
{'matchRoute result: ' + JSON.stringify(useMatchRoute()({ to: '/' }))}
right above<Outlet />
base: '/somebase',
basepath: '/somebase',
tocreateRouter
options/somebase
to urlmatchRoute result: false
in the rendered outputExpected behavior
As a user I expected the useMatchRoute() invocation to continue positively matching against the '/' route even when a basepath was added to the router and vite configs. I have tried many things, like trying to match it against '/somebase' or '/somebase/', no dice, it always returns
false
. This also happens for nested routes, not just the top-level '/' route.Screenshots or Videos
No response
Platform
Additional context
(love this project :) )