From 89f82707d68f0684704f3b4b7e7fbaca8e1b5026 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 2 Nov 2023 20:13:00 +0800 Subject: [PATCH] Let's try this out Sometimes the logic gets confusing --- src/pages/notifications.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/notifications.jsx b/src/pages/notifications.jsx index 8cf6e35..5ce177f 100644 --- a/src/pages/notifications.jsx +++ b/src/pages/notifications.jsx @@ -54,8 +54,6 @@ function Notifications({ columnMode }) { const notificationsIterator = useRef(); async function fetchNotifications(firstLoad) { - states.notificationsShowNew = false; // Hide "new notifications" button early - if (firstLoad || !notificationsIterator.current) { // Reset iterator notificationsIterator.current = masto.v1.notifications.list({ @@ -176,6 +174,8 @@ function Notifications({ columnMode }) { // } // }, [nearReachEnd, showMore]); + const [showNew, setShowNew] = useState(false); + const loadUpdates = useCallback( ({ disableIdleCheck = false } = {}) => { console.log('✨ Load updates', { @@ -195,6 +195,8 @@ function Notifications({ columnMode }) { uiState !== 'loading' ) { loadNotifications(true); + } else { + setShowNew(snapStates.notificationsShowNew); } }, [snapStates.notificationsShowNew, snapStates.settings.autoRefresh, uiState], @@ -291,7 +293,7 @@ function Notifications({ columnMode }) { {/*