From 3ff4dcff59061b73f862eab1eae5064ec6398674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Best?= Date: Thu, 2 Jan 2025 16:26:04 +0000 Subject: [PATCH] fix: Forward user-defined location.state --- packages/nuqs/src/adapters/lib/react-router.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nuqs/src/adapters/lib/react-router.ts b/packages/nuqs/src/adapters/lib/react-router.ts index 846d6758..408b2df6 100644 --- a/packages/nuqs/src/adapters/lib/react-router.ts +++ b/packages/nuqs/src/adapters/lib/react-router.ts @@ -16,6 +16,7 @@ type NavigateUrl = { type NavigateOptions = { replace?: boolean preventScrollReset?: boolean + state?: unknown } type NavigateFn = (url: NavigateUrl, options: NavigateOptions) => void type UseNavigate = () => NavigateFn @@ -60,7 +61,8 @@ export function createReactRouterBasedAdapter( }, { replace: true, - preventScrollReset: true + preventScrollReset: true, + state: history.state?.usr } ) }