Skip to content

Commit

Permalink
fix window
Browse files Browse the repository at this point in the history
  • Loading branch information
codehz committed Jan 31, 2024
1 parent d084f99 commit 821a431
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions router/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export const ReloadContext = createContext(async (): Promise<void> => {});
* 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
Expand All @@ -98,7 +97,7 @@ export function useRouteState<T extends {}>(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 = ({
Expand Down

0 comments on commit 821a431

Please sign in to comment.