remove throttle from main layout resize

This commit is contained in:
jeffvli
2025-11-16 21:38:47 -08:00
parent af67e367e8
commit 44eca6fac0
@@ -1,7 +1,6 @@
import clsx from 'clsx'; import clsx from 'clsx';
import throttle from 'lodash/throttle';
import { motion } from 'motion/react'; import { motion } from 'motion/react';
import { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { lazy, Suspense, useCallback, useEffect, useRef, useState } from 'react';
import { Outlet, useLocation } from 'react-router'; import { Outlet, useLocation } from 'react-router';
import styles from './main-content.module.css'; import styles from './main-content.module.css';
@@ -110,16 +109,14 @@ export const MainContent = ({ shell }: { shell?: boolean }) => {
[isResizing, isResizingRight, setSideBar], [isResizing, isResizingRight, setSideBar],
); );
const throttledResize = useMemo(() => throttle(resize, 10), [resize]);
useEffect(() => { useEffect(() => {
window.addEventListener('mousemove', throttledResize); window.addEventListener('mousemove', resize);
window.addEventListener('mouseup', stopResizing); window.addEventListener('mouseup', stopResizing);
return () => { return () => {
window.removeEventListener('mousemove', throttledResize); window.removeEventListener('mousemove', resize);
window.removeEventListener('mouseup', stopResizing); window.removeEventListener('mouseup', stopResizing);
}; };
}, [throttledResize, stopResizing]); }, [resize, stopResizing]);
return ( return (
<motion.div <motion.div