solidjs / solid-router

A universal router for Solid inspired by Ember and React Router
MIT License
1.1k stars 137 forks source link

A component isActive subpath match incorrect #422

Closed madaxen86 closed 1 month ago

madaxen86 commented 1 month ago

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

Additional context

No response