router
router copied to clipboard
useMatchRoute will match `routes/about.tsx` on `routes/$var`.
Describe the bug
When visiting routes/about.tsx, isOnVarRoute is true here
const matchRoute = useMatchRoute();
const isOnVarRoute = Boolean(matchRoute({ to: '/$var' }));
Your Example Website or App
https://stackblitz.com/edit/github-pimzz4?file=src%2Froutes%2F__root.tsx
Steps to Reproduce the Bug or Issue
- Click the
Aboutlink - Look at the
isOn$varRoutevalue in the header. It says true, even though we're visiting the non-dynamic route/about.
Expected behavior
I expect useMatchRoute to not match static paths in dynamic segments.
Screenshots or Videos
No response
Platform
- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 91.1]
Additional context
No response