Skip to content

Commit

Permalink
Add auth state dedup logic
Browse files Browse the repository at this point in the history
  • Loading branch information
taldekar committed Jan 22, 2025
1 parent dc8b198 commit 2930b70
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ public final class DefaultAuthStateManager implements AuthStateManager {
private LoginParams loginParams; // used in login's getSsoToken params
private String issuerUrl; // used in AmazonQLspClientImpl.getConnectionMetadata()
private String ssoTokenId; // used in logout's invalidateSsoToken params
private AuthState previousAuthState;

public DefaultAuthStateManager(final PluginStore pluginStore) {
previousAuthState = null;
this.authPluginStore = new AuthPluginStore(pluginStore);
syncAuthStateWithPluginStore();
}
Expand Down Expand Up @@ -120,7 +122,12 @@ private void updateState(final AuthStateType authStatusType, final LoginType log
* This notification is critical for ensuring all plugin components reflect the current
* authentication state.
*/
EventBroker.getInstance().post(getAuthState());
AuthState currentAuthState = getAuthState();
if (!currentAuthState.equals(previousAuthState)) {
EventBroker.getInstance().post(getAuthState());
previousAuthState = currentAuthState;
}

}

private void syncAuthStateWithPluginStore() {
Expand Down

0 comments on commit 2930b70

Please sign in to comment.