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

Routing to a query returns to the default route

Open hassanbazzi opened this issue 7 years ago • 2 comments

Demo: http://jsfiddle.net/qc73v9va/49/

If you click Profile, then click the Click me for query link, you'll be redirected to the homepage.

My use case is that I want to be on any route /x/y and then easily attach a query param to it / update it.

Maybe I'm doing this wrong, but I expect route to do that. I can obviously grab the location, but just wondering if this is expected behavior.

hassanbazzi avatar Aug 03 '17 20:08 hassanbazzi

Definitely worth adding yup. Technically this is a dupe of #129 - if we supported relative paths in route() and links, route('?foo') would be relative to the current route instead of being treated as /?foo.

developit avatar Sep 08 '17 22:09 developit

There's a PR open for the behavior if you're up for reviewing! #138 and my alternative that abuses the DOM to do it, #177.

developit avatar Sep 08 '17 22:09 developit