@@ -41,7 +41,6 @@ import {
4141 removeAccount ,
4242} from '../utils/auth/utils' ;
4343import {
44- decryptValue ,
4544 encryptValue ,
4645 setAutoLaunch ,
4746 setKeyboardShortcut ,
@@ -131,10 +130,25 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
131130 [ unreadNotificationCount ] ,
132131 ) ;
133132
134- // biome-ignore lint/correctness/useExhaustiveDependencies: restoreSettings is stable and should run only once
133+ const restoreSettings = useCallback ( async ( ) => {
134+ const existing = loadState ( ) ;
135+
136+ // Restore settings before accounts to ensure filters are available before fetching notifications
137+ if ( existing . settings ) {
138+ setSettings ( { ...defaultSettings , ...existing . settings } ) ;
139+ }
140+
141+ if ( existing . auth ) {
142+ setAuth ( { ...defaultAuth , ...existing . auth } ) ;
143+
144+ // Trigger the effect to refresh accounts and handle token encryption
145+ setNeedsAccountRefresh ( true ) ;
146+ }
147+ } , [ ] ) ;
148+
135149 useEffect ( ( ) => {
136150 restoreSettings ( ) ;
137- } , [ ] ) ;
151+ } , [ restoreSettings ] ) ;
138152
139153 // Refresh account details on startup or restore
140154 useEffect ( ( ) => {
@@ -151,6 +165,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
151165 } ) ( ) ;
152166 } , [ needsAccountRefresh , auth . accounts ] ) ;
153167
168+ // Refresh account details on interval
154169 useIntervalTimer ( ( ) => {
155170 for ( const account of auth . accounts ) {
156171 refreshAccount ( account ) ;
@@ -328,21 +343,6 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
328343 [ auth , settings , removeAccountNotifications ] ,
329344 ) ;
330345
331- const restoreSettings = useCallback ( async ( ) => {
332- const existing = loadState ( ) ;
333-
334- // Restore settings before accounts to ensure filters are available before fetching notifications
335- if ( existing . settings ) {
336- setSettings ( { ...defaultSettings , ...existing . settings } ) ;
337- }
338-
339- if ( existing . auth ) {
340- setAuth ( { ...defaultAuth , ...existing . auth } ) ;
341- // Trigger the effect to refresh accounts and handle token encryption
342- setNeedsAccountRefresh ( true ) ;
343- }
344- } , [ ] ) ;
345-
346346 const fetchNotificationsWithAccounts = useCallback (
347347 async ( ) => await fetchNotifications ( { auth, settings } ) ,
348348 [ auth , settings , fetchNotifications ] ,
0 commit comments