solid-router icon indicating copy to clipboard operation
solid-router copied to clipboard

useMatch can not match optional parameters

Open weijarz opened this issue 3 years ago • 0 comments

Describe the bug

const TAG_PATH = '/tags/:label/:entryId?'

<Route path={TAG_PATH} ... />

... 

const isMatch = useMatch(() =>TAG_PATH)

Here useMatch(() =>TAG_PATH) can match path with 'entryId' param like '/tags/1/2', but can not match path '/tags/100'

Your Example Website or App

https://stackblitz.com/edit/vitejs-vite-c19mmd?file=src/App.tsx

Steps to Reproduce the Bug or Issue

Click '/categories/1 ' link, it does not match current location.

Expected behavior

It should match.

Screenshots or Videos

No response

Platform

  • OS: all
  • Browser: all
  • Version: 1.5

Additional context

No response

weijarz avatar Sep 16 '22 11:09 weijarz