Skip to content

Commit 14c6605

Browse files
authored
fix: clear AttemptStateMap after successful sign-in and optin COMPASS-7342 (#7418)
clear AttemptStateMap after successful sign-in and optin
1 parent 16e9c9e commit 14c6605

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/atlas-service/src/store/atlas-signin-reducer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const AttemptStateMap = new Map<number, AttemptState>();
117117

118118
export let attemptId = 0;
119119

120-
export function getAttempt(id?: number | null): AttemptState {
120+
function getAttempt(id?: number | null): AttemptState {
121121
if (!id) {
122122
id = ++attemptId;
123123
const controller = new AbortController();
@@ -360,6 +360,7 @@ export const signIn = (): AtlasSignInThunkAction<Promise<void>> => {
360360
});
361361
dispatch({ type: AtlasSignInActions.Success, userInfo });
362362
atlasAuthService.emit('signed-in');
363+
AttemptStateMap.clear();
363364
resolve(userInfo);
364365
} catch (err) {
365366
// Only handle error if sign in wasn't aborted by the user, otherwise it

packages/compass-generative-ai/src/store/atlas-optin-reducer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ export const optIn = (): GenAIAtlasOptInThunkAction<Promise<void>> => {
277277
throwIfAborted(signal);
278278
await atlasAiService.optIntoGenAIFeatures();
279279
dispatch(atlasAiServiceOptedIn());
280+
AttemptStateMap.clear();
280281
resolve();
281282
} catch (err) {
282283
if (signal.aborted) {

0 commit comments

Comments
 (0)