Repository: gitify-app/gitify (ts)

Issue:
Unable to recover from Network Error until reboot Gitify
### 🔍 Is there already an issue for your problem?

- [X] I have checked older issues, open and closed

### 📝 Description

Since v5.12.0, an error screen that shows Network Error has appeared in my environment. Once in this state, Gitify does not seem to recover from this state until it is restarted.
<img width="498" alt="network_error" src="https://github.com/user-attachments/assets/0bfabb2e-157e-47cb-b111-cd8e6efe26df">

Here, I enabled debug mode and tried reloading, which did not recover from the error screen despite everything returning 200 for each requests.
![network_error_debug](https://github.com/user-attachments/assets/8f3601f3-5723-4fc2-8600-e28e7c743a25)

When Gitify was simply restarted in this state, everything worked correctly.

### 🪜 Steps To Reproduce

1. Open Gitify and confirm that it is fine.
2. Turn off Wi-Fi and/or disconnect from wired network.
3. Reload Gitify manually

### Gitify Version

Other

### Operating System

macOS

### GitHub Account

Combination

### 📸 Screenshots

_No response_

Pull request description:
fix: clear global error state on fetch
resolves #1441 

Patch:
diff --git a/src/hooks/useNotifications.ts b/src/hooks/useNotifications.ts
index a5f385ab..a6d39293 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 17543e54..0e60f1a8 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 <Oops error={globalError} />;
+  if (status === 'error') {
+    return <Oops error={globalError ?? Errors.UNKNOWN} />;
   }
 
   if (!hasNotifications && hasNoAccountErrors) {


Test patch:
diff --git a/src/routes/__snapshots__/Notifications.test.tsx.snap b/src/routes/__snapshots__/Notifications.test.tsx.snap
index 5dbd7314..8bb99d30 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": <body>
     <div>
       <p>
-        AllRead
+        Oops
       </p>
     </div>
   </body>,
   "container": <div>
     <p>
-      AllRead
+      Oops
     </p>
   </div>,
   "debug": [Function],