Skip to content

Commit

Permalink
Fix useSearchParams to delete current appended url before appending a…
Browse files Browse the repository at this point in the history
…nother
  • Loading branch information
mutuajames committed Jun 22, 2023
1 parent 145a4d9 commit a78fa66
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/react-utils/src/hooks/useSearchParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export function useSearchParams() {
if (!value) {
return;
}
if (queryKey) {
sParams.delete(queryKey);
}
sParams.append(queryKey, value);
const newParams = sParams.toString();
nextUrl = ''.concat(nextUrl, '?').concat(newParams.toString());
Expand Down

0 comments on commit a78fa66

Please sign in to comment.