From 821a43196c6c40c2ec5f9c841b11afcf651ff61f Mon Sep 17 00:00:00 2001 From: codehz Date: Wed, 31 Jan 2024 12:43:05 +0800 Subject: [PATCH] fix window --- router/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/router/index.tsx b/router/index.tsx index 78ee3d1..07a2c20 100644 --- a/router/index.tsx +++ b/router/index.tsx @@ -88,7 +88,6 @@ export const ReloadContext = createContext(async (): Promise => {}); * Returns a stateful value which bounded to route, and a function to update it. * Note that the value won't be updated across components. * So you should use this only in top-most component - * @experimental * @param key unique key * @param initial initial value * @returns value and setter @@ -98,7 +97,7 @@ export function useRouteState(key: string, initial: T) { const routeState = history.state ?? {}; history.replaceState({ ...routeState, [key]: newvalue }, ""); return newvalue; - }, (window?.history?.state?.[key] ?? initial) as unknown as T); + }, (globalThis.history?.state?.[key] ?? initial) as unknown as T); } export const RouterHost = ({