Skip to content

Unsetting search params in a URL with a hash fragment navigates to "/" #578

Description

@developerdizzle

Describe the bug

Given a URL with both search parameters and a hash fragment, unsetting the search params results in navigation to "/", losing any existing path/route.

The linked example does not actually run properly in the playground, but you can copy it to repro locally.

Your Example Website or App

https://playground.solidjs.com/developerdizzle/2f1f4876-fb97-4ce3-bede-d0e23e93b663

Steps to Reproduce the Bug or Issue

  1. Navigate to a route with a querystring param and hash fragment, e.g.: /demo?foo=bar#test
  2. Call setSearchParams({ foo: "" })
  3. Notice the URL has changed to /#test

The bug does not happen if no hash fragment exists

Expected behavior

The existing route/path is maintained

Screenshots or Videos

solidjsrouterbug.mp4

Platform

  • OS: Linux Mint
  • Browser: Chrome
  • Version: 150.0.7871.46

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions