fix useQueryState replaceState

This commit is contained in:
Sylver 2024-01-07 12:26:27 +08:00
parent 40cbaaca8b
commit 62b91a8316
2 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ export const useQueryState = <S>(key: string, initialState?: S, parser?: (input:
const route = new URL(window.location.href);
if (value === initialState) route.searchParams.delete(key);
else route.searchParams.set(key, `${value}`);
history.replaceState(null, '', route.toString());
history.replaceState(window.history.state, '', route.toString());
}, [value, initialState, key]);
return [value, setValue] as const;

View File

@ -41,7 +41,7 @@ export default function ViewPaste() {
setBurnUnless(burnUnless);
url.searchParams.delete('burn_unless');
window.history.replaceState(null, '', url.href);
window.history.replaceState(window.history.state, '', url.href);
}, [router]);
useEffect(() => {