Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-router HashRouter support? #810

Open
Jungzl opened this issue Dec 16, 2024 · 2 comments
Open

react-router HashRouter support? #810

Jungzl opened this issue Dec 16, 2024 · 2 comments
Labels
adapters/react-router Uses the React Router adapter feature New feature or request

Comments

@Jungzl
Copy link

Jungzl commented Dec 16, 2024

Context

What's your version of nuqs?

-> https://pkg.pr.new/nuqs@807

What framework are you using?

  • ✅ React Router

Which version of your framework are you using?

-> 7.0.2

Description

For some reason, we can't use BrowserRouter in RR7, only HashRouter allowed. But useQueryState always append the whole hash part.

Expect:

http://localhost:5173/#/form
⇓
http://localhost:5173/#/form?keyword=kw
⇓
http://localhost:5173/#/form?keyword=kw1
⇓
http://localhost:5173/#/form?keyword=kw12
⇓
http://localhost:5173/#/form?keyword=kw123

Actual:

http://localhost:5173/#/form
⇓
http://localhost:5173/#/form?keyword=kw#/form
⇓
http://localhost:5173/#/form?keyword=kw1#/form?keyword=kw#/form
⇓
http://localhost:5173/#/form?keyword=kw12#/form?keyword=kw1#/form?keyword=kw#/form
⇓
http://localhost:5173/#/form?keyword=kw123#/form?keyword=kw12#/form?keyword=kw1#/form?keyword=kw#/form

Reproduction

https://github.com/Jungzl/react-router-nuqs-hash-issue

  1. go to '/form'
  2. type something, press Enter
  3. see url
@Jungzl Jungzl added the bug Something isn't working label Dec 16, 2024
@franky47
Copy link
Member

Thanks, I'm going to mark this one as a feature request to support the HashRouter in RRv{6,7}, as the adapters have only been designed for search params in mind (the BrowserRouter).

Fortunately, the change in #800 should make it possible.

See also #206.

@franky47 franky47 added feature New feature or request adapters/react-router Uses the React Router adapter and removed bug Something isn't working labels Dec 16, 2024
@franky47 franky47 added this to the 🪵 Backlog milestone Dec 16, 2024
@franky47 franky47 removed this from the 🪵 Backlog milestone Dec 27, 2024
@sebbean
Copy link

sebbean commented Dec 29, 2024

supp future self!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters/react-router Uses the React Router adapter feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants