From 78f6c74407a1edb214b55e682f47335a3001c02d Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sat, 14 Sep 2024 06:52:21 -0400 Subject: [PATCH] fix: restore settings order Signed-off-by: Adam Setch --- src/context/App.tsx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/context/App.tsx b/src/context/App.tsx index 1b434dbee..2d0053cdc 100644 --- a/src/context/App.tsx +++ b/src/context/App.tsx @@ -138,6 +138,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => { markRepoNotificationsDone, } = useNotifications(); getNotificationCount; + useEffect(() => { restoreSettings(); }, []); @@ -266,15 +267,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => { await migrateAuthenticatedAccounts(); const existing = loadState(); - if (existing.auth) { - setAuth({ ...defaultAuth, ...existing.auth }); - - // Refresh account data on app start - for (const account of existing.auth.accounts) { - await refreshAccount(account); - } - } - + // Restore settings before accounts to ensure filters are available before fetching notifications if (existing.settings) { setKeyboardShortcut(existing.settings.keyboardShortcut); setAlternateIdleIcon(existing.settings.useAlternateIdleIcon); @@ -283,6 +276,15 @@ export const AppProvider = ({ children }: { children: ReactNode }) => { zoomPercentageToLevel(existing.settings.zoomPercentage), ); } + + if (existing.auth) { + setAuth({ ...defaultAuth, ...existing.auth }); + + // Refresh account data on app start + for (const account of existing.auth.accounts) { + await refreshAccount(account); + } + } }, []); const fetchNotificationsWithAccounts = useCallback(