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

setSearchParams doubles up base string

Open timothyallan opened this issue 1 year ago • 0 comments

Describe the bug

I believe this is possibly a regression from https://github.com/solidjs/solid-router/pull/170 ?

I've got a <Router base="app"></Router> setup in my main application.

const [params, setParams] = useSearchParams();

if (params.blah) {
    // do stuff
    setParams({ blah: undefined });
}

I want to clear certain search params, and while this 'works' by clearing the params, it also appends another '/app' onto my url. i.e. if I go to mydomain.com/app/page1?blah=true and that code runs, I am now on mydomain.com/app/app/page1, which of course gives me a 404.

without the base parameter in <Router> this works as it should.

Your Example Website or App

.

Steps to Reproduce the Bug or Issue

Code listed above...

Expected behavior

Search params should just be set/removed and the actual url location shouldn't be modified when using the base property.

Screenshots or Videos

No response

Platform

"vite": "^3.1.7"
"vite-plugin-solid": "^2.3.9"
"solid-js": "^1.5.7"
"@solidjs/router": "^0.5.0"

Additional context

No response

timothyallan avatar Oct 12 '22 19:10 timothyallan