debounce motion only button

This commit is contained in:
Josh Hawkins 2024-04-04 08:20:31 -05:00
parent 0096a6d778
commit 4f0a7d961a

View File

@ -633,10 +633,10 @@ function ShowMotionOnlyButton({
}: ShowMotionOnlyButtonProps) { }: ShowMotionOnlyButtonProps) {
const [motionOnlyButton, setMotionOnlyButton] = useState(motionOnly); const [motionOnlyButton, setMotionOnlyButton] = useState(motionOnly);
useEffect( useEffect(() => {
() => setMotionOnly(motionOnlyButton), const timeoutId = setTimeout(() => setMotionOnly(motionOnlyButton), 10);
[motionOnlyButton, setMotionOnly], return () => clearTimeout(timeoutId);
); }, [motionOnlyButton, setMotionOnly]);
return ( return (
<> <>