Skip to content

Commit 356c9b1

Browse files
committed
fix: Protection against null useSearchParams in Next.js
Closes #780.
1 parent a504e0e commit 356c9b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/nuqs/src/useQueryState.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export function useQueryState<T = string>(
252252
)
253253

254254
useEffect(() => {
255-
const query = initialSearchParams.get(key) ?? null
255+
const query = initialSearchParams?.get(key) ?? null
256256
if (query === queryRef.current) {
257257
return
258258
}

0 commit comments

Comments
 (0)