Skip to content

Commit 17dccbb

Browse files
committed
fix: Implement scroll for the React SPA adapter
1 parent 8d0a9b9 commit 17dccbb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/nuqs/src/adapters/react.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ function updateUrl(search: URLSearchParams, options: AdapterOptions) {
1414
options.history === 'push' ? history.pushState : history.replaceState
1515
method.call(history, history.state, '', url)
1616
emitter.emit('update', search)
17+
if (options.scroll === true) {
18+
window.scrollTo({ top: 0 })
19+
}
1720
}
1821

1922
function useNuqsReactAdapter() {

0 commit comments

Comments
 (0)