We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f35cc69 commit 9fe8b83Copy full SHA for 9fe8b83
router/index.tsx
@@ -95,7 +95,8 @@ export const ReloadContext = createContext(async (): Promise<void> => {});
95
export function useRouteState<T extends {}>(key: string, initial: T) {
96
return useReducer((_old: T, newvalue: T) => {
97
const routeState = history.state ?? {};
98
- history.replaceState({ ...routeState, [key]: newvalue }, "");
+ if (routeState[key] !== newvalue)
99
+ history.replaceState({ ...routeState, [key]: newvalue }, "");
100
return newvalue;
101
}, (globalThis.history?.state?.[key] ?? initial) as unknown as T);
102
}
0 commit comments