|
|
|
@ -111,7 +111,7 @@ export function useThrottle<F extends GenericFunction>(fn: F, ms: number) {
|
|
|
|
|
const fnRef = useRef(fn);
|
|
|
|
|
fnRef.current = fn;
|
|
|
|
|
|
|
|
|
|
const timer = useRef<number>();
|
|
|
|
|
const timer = useRef<number>(undefined);
|
|
|
|
|
|
|
|
|
|
return useCallback(
|
|
|
|
|
(...args: Parameters<F>) => {
|
|
|
|
@ -153,7 +153,7 @@ export function useOnValueChange<T>(value: T, onChange: (value: T) => void) {
|
|
|
|
|
|
|
|
|
|
// Mantine's useInterval has some weird issues. This is a workaround.
|
|
|
|
|
export function useInterval(fn: VoidFunction, ms: number) {
|
|
|
|
|
const timer = useRef<number>();
|
|
|
|
|
const timer = useRef<number>(undefined);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
timer.current = window.setInterval(fn, ms);
|
|
|
|
|