diff --git a/src/hooks/useNotifications.ts b/src/hooks/useNotifications.ts index a5f385ab2..a6d392938 100644 --- a/src/hooks/useNotifications.ts +++ b/src/hooks/useNotifications.ts @@ -60,6 +60,7 @@ export const useNotifications = (): NotificationsState => { const fetchNotifications = useCallback( async (state: GitifyState) => { setStatus('loading'); + setGlobalError(null); const fetchedNotifications = await getAllNotifications(state); diff --git a/src/routes/Notifications.tsx b/src/routes/Notifications.tsx index 17543e543..0e60f1a8f 100644 --- a/src/routes/Notifications.tsx +++ b/src/routes/Notifications.tsx @@ -4,10 +4,12 @@ import { AllRead } from '../components/AllRead'; import { Oops } from '../components/Oops'; import { AppContext } from '../context/App'; import { getAccountUUID } from '../utils/auth/utils'; +import { Errors } from '../utils/constants'; import { getNotificationCount } from '../utils/notifications'; export const NotificationsRoute: FC = () => { - const { notifications, globalError, settings } = useContext(AppContext); + const { notifications, status, globalError, settings } = + useContext(AppContext); const hasMultipleAccounts = useMemo( () => notifications.length > 1, @@ -24,8 +26,8 @@ export const NotificationsRoute: FC = () => { [notifications], ); - if (globalError) { - return ; + if (status === 'error') { + return ; } if (!hasNotifications && hasNoAccountErrors) { diff --git a/src/routes/__snapshots__/Notifications.test.tsx.snap b/src/routes/__snapshots__/Notifications.test.tsx.snap index 5dbd73147..8bb99d300 100644 --- a/src/routes/__snapshots__/Notifications.test.tsx.snap +++ b/src/routes/__snapshots__/Notifications.test.tsx.snap @@ -144,13 +144,13 @@ exports[`routes/Notifications.tsx should render itself & its children (error con "baseElement":

- AllRead + Oops

, "container":

- AllRead + Oops

, "debug": [Function],