perf(catalog): memoize handleNewerPostsButtonClick with useCallback

This commit is contained in:
plebeius
2026-02-23 19:01:15 +08:00
parent f9325b907c
commit 8f8c6254cc
+2 -2
View File
@@ -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);