mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-06 20:10:12 +02:00
memoize and reset scrollEnd handler on grid list
This commit is contained in:
@@ -265,7 +265,16 @@ export const ItemGridList = ({
|
||||
[onScrollEnd],
|
||||
);
|
||||
|
||||
const debouncedOnScrollEnd = debounce(handleOnScrollEnd, 150);
|
||||
const debouncedOnScrollEnd = useMemo(
|
||||
() => debounce(handleOnScrollEnd, 150),
|
||||
[handleOnScrollEnd],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
debouncedOnScrollEnd.cancel();
|
||||
};
|
||||
}, [debouncedOnScrollEnd]);
|
||||
|
||||
const handleScroll = useCallback(
|
||||
(e: UIEvent<HTMLDivElement>) => {
|
||||
|
||||
Reference in New Issue
Block a user