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

[Feature] [v6]: add replace option to useSearchParams or setSearchParams #8062

Closed
ryanflorence opened this issue Sep 21, 2021 · 3 comments
Closed

Comments

@ryanflorence
Copy link
Member

What is the new or updated feature that you are suggesting?

let [params, setParams] = useSearchParams({ replace: true });
setParams();

// or
let [params, setParams] = useSearchParams({ replace: true });
setParams(newParams, { replace: true });

Why should this feature be included?

When manipulating the search params you don't always want push. Probably the most common use case is plugging into an <input type="text" />, so every keystroke gets an entry in the history stack 😨😂

@tifosiblack
Copy link

You can already do setParams(newParams, { replace: true }); but you want to be able to define the default options on the hook itself ?

@judicaelandria
Copy link

@ryanflorence are you already working on this Feature or can I work on it? :)

@mjackson
Copy link
Member

Yeah, you can already do setSearchParams(params, { replace: true }) so I think that should be good enough.

brophdawg11 pushed a commit that referenced this issue Mar 27, 2024
…ndler (#8062)

Co-authored-by: Mark Dalgleish <mark.john.dalgleish@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants