From dd270b37dc16a12c9016624cc5823d814f7ab6cd Mon Sep 17 00:00:00 2001 From: Roland Date: Sat, 7 Mar 2026 16:24:20 -0700 Subject: [PATCH] Not clearing settings when frontend fails to fetch, this caused the navbar color and such to be forgotten. --- app/src/hooks/customHooks.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/hooks/customHooks.js b/app/src/hooks/customHooks.js index 9389a7ea..40bfa875 100644 --- a/app/src/hooks/customHooks.js +++ b/app/src/hooks/customHooks.js @@ -1020,9 +1020,12 @@ export const useSettings = () => { } setPending(true); try { - setSettings(await getSettings()) + const newSettings = await getSettings(); + if (newSettings) { + setSettings(newSettings); + } } catch (e) { - setSettings({}); + // Don't clear settings on error — keep the last known good values. } finally { setPending(false); } @@ -1056,7 +1059,10 @@ export const useStatus = () => { try { // Fetch from both endpoints in parallel const [appStatus, controllerStats] = await Promise.all([ - getStatus().catch(e => { + getStatus().then(result => { + window.apiDown = false; + return result; + }).catch(e => { if (e instanceof ApiDownError) { window.apiDown = true; return {}; @@ -1072,7 +1078,6 @@ export const useStatus = () => { // Merge both responses - controller stats override app status for system info setStatus({...appStatus, ...controllerStats}); - window.apiDown = false; } catch (e) { if (e instanceof ApiDownError) { // API is down, do not log this error.