From d235f56cffa3216da37fe4ecaee1058951ca3abd Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 2 Jan 2023 23:19:12 +0800 Subject: [PATCH] Always clear 'new' when load from beginning --- src/pages/home.jsx | 2 +- src/pages/notifications.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home.jsx b/src/pages/home.jsx index b3e09a6a..105cd107 100644 --- a/src/pages/home.jsx +++ b/src/pages/home.jsx @@ -47,6 +47,7 @@ function Home({ hidden }) { }); if (firstLoad) { states.home = homeValues; + states.homeNew = []; } else { states.home.push(...homeValues); } @@ -255,7 +256,6 @@ function Home({ hidden }) { ); states.home.unshift(...uniqueHomeNew); loadStatuses(true); - states.homeNew = []; scrollableRef.current?.scrollTo({ top: 0, diff --git a/src/pages/notifications.jsx b/src/pages/notifications.jsx index bca1d660..e702c0b6 100644 --- a/src/pages/notifications.jsx +++ b/src/pages/notifications.jsx @@ -235,6 +235,7 @@ function Notifications() { }); if (firstLoad) { states.notifications = notificationsValues; + states.notificationsNew = []; } else { states.notifications.push(...notificationsValues); } @@ -257,7 +258,6 @@ function Notifications() { useEffect(() => { loadNotifications(true); - states.notificationsNew = []; }, []); const scrollableRef = useRef();