Skip to content

Commit

Permalink
fix(useUrlSearchParams): preserve history state when updating query (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
arcs- committed Jun 16, 2022
1 parent 1674063 commit 1ef51e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/core/useUrlSearchParams/index.ts
Expand Up @@ -116,7 +116,11 @@ export function useUrlSearchParams<T extends Record<string, any> = UrlParams>(
if (shouldUpdate)
updateState(params)

window.history.replaceState({}, '', window.location.pathname + constructQuery(params))
window.history.replaceState(
window.history.state,
window.document.title,
window.location.pathname + constructQuery(params)
)

resume()
}
Expand Down

0 comments on commit 1ef51e9

Please sign in to comment.