try catch loadLastSession

This commit is contained in:
uinstinct 2025-10-07 18:30:06 +05:30
parent a58ddfa175
commit 0122c6bee8

View file

@ -159,7 +159,14 @@ export const loadLastSession = createAsyncThunk<void, void, ThunkApiType>(
return;
}
const session = await getSession(extra.ideMessenger, lastSessionId);
let session: Session;
try {
session = await getSession(extra.ideMessenger, lastSessionId);
} catch {
// retry again after 1 sec
await new Promise((resolve) => setTimeout(resolve, 1000));
session = await getSession(extra.ideMessenger, lastSessionId);
}
dispatch(newSession(session));
},
);