From faf5a55100831a1b39eea67968b15c9ac7e894d0 Mon Sep 17 00:00:00 2001 From: feugy Date: Wed, 12 Jun 2024 09:46:43 +0200 Subject: [PATCH] fix(#56,#72): useSearchParams might return null and break script insertion --- packages/web/src/nextjs/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web/src/nextjs/utils.ts b/packages/web/src/nextjs/utils.ts index ef08210..d794632 100644 --- a/packages/web/src/nextjs/utils.ts +++ b/packages/web/src/nextjs/utils.ts @@ -5,7 +5,7 @@ import { computeRoute } from '../utils'; export const useRoute = (): string | null => { const params = useParams(); - const searchParams = useSearchParams(); + const searchParams = useSearchParams() || new URLSearchParams(); const path = usePathname(); const finalParams = {