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]);
|
||||
|
||||
const handleNewerPostsButtonClick = () => {
|
||||
const handleNewerPostsButtonClick = useCallback(() => {
|
||||
window.scrollTo({ top: 0, left: 0 });
|
||||
setTimeout(() => {
|
||||
reset();
|
||||
}, 300);
|
||||
};
|
||||
}, [reset]);
|
||||
|
||||
// suggest the user to change time filter if there aren't enough posts
|
||||
const setResetFunction = useFeedResetStore((state) => state.setResetFunction);
|
||||
|
||||
Reference in New Issue
Block a user