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

When hosted under a subdirectory the root (`/`) link is not highlighted when there is a trailing `/`

Open drum445 opened this issue 3 years ago • 0 comments

Describe the bug

I have a solidJS app hosted under domain.com/solidjs/.

My Router is setup with a base property: <Router base="solidjs"> And my vite config has base: "/solidjs/";

Everything seems to be working correctly, except when navigating to my URL or refreshing the page on the root path, even though the home route is correctly rendered, the following link is not given an active status

<A class="nav-link" href="/" end={true}>
  Home
</A>

This is not an issue for any of my other page links (even those that also have end={true})

After investigating it seems to be entirely due to whether there is a trailing slash on my root page's URL

domain.com/solidjs - works correctly and the / link is set to active domain.com/solidjs/ - does not set the / link to active

I can tweak my nginx config to not auto-add the trailing slash, but as this is not a problem with either the react or vue routers, so I thought it worth raising.

Many Thanks

Your Example Website or App

https://izrite.com/solid-explore/

Steps to Reproduce the Bug or Issue

Go to https://izrite.com/solid-explore/ - see the Home link is not active Go to https://izrite.com/solid-explore - see the Home link is active

Expected behavior

I would expect Home <A> link to be set to active regardless of whether there is a trailing slash

Screenshots or Videos

No response

Platform

Additional context

No response

drum445 avatar Oct 13 '22 08:10 drum445