From c316f0106bfe37a3aa676d42fc1c563ab414932a Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 8 May 2023 23:16:04 +0800 Subject: [PATCH] Small optimization --- src/pages/status.jsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pages/status.jsx b/src/pages/status.jsx index 5879906c..4c441bf2 100644 --- a/src/pages/status.jsx +++ b/src/pages/status.jsx @@ -42,6 +42,7 @@ import useTitle from '../utils/useTitle'; import getInstanceStatusURL from './../utils/get-instance-status-url'; const LIMIT = 40; +const MAX_WEIGHT = 5; let cachedRepliesToggle = {}; let cachedStatusesMap = {}; @@ -595,11 +596,7 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) { }); }, []); - const totalWeight = useMemo(() => { - return statuses.reduce((acc, status) => { - return acc + status.weight; - }, 0); - }, [id, statuses?.length]); + const totalWeight = statuses?.length; return (