fix: debounce URL updates to prevent History API errors
This commit is contained in:
@@ -294,11 +294,17 @@ function App() {
|
||||
const [slider, setSlider] = useState(initialSlider);
|
||||
|
||||
useEffect(() => {
|
||||
const handler = setTimeout(() => {
|
||||
const params = new URLSearchParams();
|
||||
params.set('duration', duration.id);
|
||||
params.set('end', end.unix());
|
||||
params.set('slider', slider.join(','));
|
||||
window.history.replaceState({}, '', `${window.location.pathname}?${params.toString()}`);
|
||||
}, 500);
|
||||
|
||||
return () => {
|
||||
clearTimeout(handler);
|
||||
};
|
||||
}, [duration, end, slider]);
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user