mirror of https://github.com/sylv/micro.git
fix useQueryState replaceState
This commit is contained in:
parent
40cbaaca8b
commit
62b91a8316
|
@ -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;
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
Loading…
Reference in New Issue