Skip to content

Commit 945c05f

Browse files
set auth state before firing event
This may not actually do anything, but we risked something reading the stale state after emitting the event because we set it after the fire(). Signed-off-by: nkomonen-amazon <[email protected]>
1 parent 7fc386e commit 945c05f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/core/src/auth/auth2.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,14 @@ export class SsoLogin implements BaseLogin {
325325
}
326326

327327
private updateConnectionState(state: AuthState) {
328-
if (this.connectionState !== state) {
329-
this.eventEmitter.fire({ id: this.profileName, state })
328+
const oldState = this.connectionState
329+
const newState = state
330+
331+
this.connectionState = newState
332+
333+
if (oldState !== newState) {
334+
this.eventEmitter.fire({ id: this.profileName, state: this.connectionState })
330335
}
331-
this.connectionState = state
332336
}
333337

334338
private ssoTokenChangedHandler(params: SsoTokenChangedParams) {

0 commit comments

Comments
 (0)