router icon indicating copy to clipboard operation
router copied to clipboard

useMatchRoute will match `routes/about.tsx` on `routes/$var`.

Open jakst opened this issue 1 year ago • 0 comments

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

  1. Click the About link
  2. Look at the isOn$varRoute value 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

jakst avatar Jun 17 '24 08:06 jakst