From 56e15a062eb85db9d0d69f0128f09882549bd4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Best?= Date: Sat, 23 Nov 2024 13:26:32 +0100 Subject: [PATCH] fix: Protection against null useSearchParams in Next.js (#781) --- packages/nuqs/src/useQueryState.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuqs/src/useQueryState.ts b/packages/nuqs/src/useQueryState.ts index 2cb765b0..08148783 100644 --- a/packages/nuqs/src/useQueryState.ts +++ b/packages/nuqs/src/useQueryState.ts @@ -252,7 +252,7 @@ export function useQueryState( ) useEffect(() => { - const query = initialSearchParams.get(key) ?? null + const query = initialSearchParams?.get(key) ?? null if (query === queryRef.current) { return }