solidjs/solid-router

A component isActive subpath match incorrect

Closed this issue · 0 comments

Describe the bug

"/foo" should not match if current route is "/foobar", but should match for "/foo" or "/foo/...".

Your Example Website or App

https://stackblitz.com/edit/github-a9ukgq-agqnyl?file=src%2Fapp.tsx

Steps to Reproduce the Bug or Issue

  1. Go to the provided stackblitz
  2. click on "A: foo:1"
  3. only "A: foo" and "A: foo:1" should be bold
  4. The provided Link component has expected behavior. I will provide this solution as a PR. (Note: Difference tu current implementations is that the home route "/" will only be active when the current path is "/".)

Expected behavior

I expect on route "/foobar" the A with "/foo" not to be active as this is not a subpath of "foo" but just another route the has the same letters at the beginning of the route.

Screenshots or Videos

image

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response