File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -142,13 +142,22 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
142142 unsubscribeNotification,
143143 } = useNotifications ( ) ;
144144
145- const refreshAllAccounts = useCallback ( ( ) => {
145+ const refreshAllAccounts = useCallback ( async ( ) => {
146146 if ( ! auth . accounts . length ) {
147147 return ;
148148 }
149149
150- return Promise . all ( auth . accounts . map ( refreshAccount ) ) ;
151- } , [ auth . accounts ] ) ;
150+ const refreshedAccounts = await Promise . all (
151+ auth . accounts . map ( ( account ) => refreshAccount ( account ) ) ,
152+ ) ;
153+
154+ const updatedAuth : AuthState = {
155+ accounts : refreshedAccounts ,
156+ } ;
157+
158+ setAuth ( updatedAuth ) ;
159+ saveState ( { auth : updatedAuth , settings } ) ;
160+ } , [ auth , settings ] ) ;
152161
153162 // TODO - Remove migration logic in future release
154163 const migrateAuthTokens = useCallback ( async ( ) => {
@@ -209,9 +218,10 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
209218
210219 // biome-ignore lint/correctness/useExhaustiveDependencies: Refresh account details on startup
211220 useEffect ( ( ) => {
212- migrateAuthTokens ( ) ;
213-
214- refreshAllAccounts ( ) ;
221+ void ( async ( ) => {
222+ await migrateAuthTokens ( ) ;
223+ await refreshAllAccounts ( ) ;
224+ } ) ( ) ;
215225 } , [ ] ) ;
216226
217227 // Refresh account details on interval
You can’t perform that action at this time.
0 commit comments