mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
perf(catalog): memoize handleNewerPostsButtonClick with useCallback
This commit is contained in:
@@ -375,12 +375,12 @@ const Catalog = ({ feedCacheKey, viewType, boardIdentifier: boardIdentifierProp,
|
|||||||
}
|
}
|
||||||
}, [filteredComments, reset]);
|
}, [filteredComments, reset]);
|
||||||
|
|
||||||
const handleNewerPostsButtonClick = () => {
|
const handleNewerPostsButtonClick = useCallback(() => {
|
||||||
window.scrollTo({ top: 0, left: 0 });
|
window.scrollTo({ top: 0, left: 0 });
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
reset();
|
reset();
|
||||||
}, 300);
|
}, 300);
|
||||||
};
|
}, [reset]);
|
||||||
|
|
||||||
// suggest the user to change time filter if there aren't enough posts
|
// suggest the user to change time filter if there aren't enough posts
|
||||||
const setResetFunction = useFeedResetStore((state) => state.setResetFunction);
|
const setResetFunction = useFeedResetStore((state) => state.setResetFunction);
|
||||||
|
|||||||
Reference in New Issue
Block a user