diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/credential_store_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/credential_store_state_machine.dart index 97384f583a..4ca8fd74f8 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/credential_store_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/credential_store_state_machine.dart @@ -49,8 +49,12 @@ final class CredentialStoreStateMachine Future resolve(CredentialStoreEvent event) async { switch (event) { case CredentialStoreLoadCredentialStore _: - emit(const CredentialStoreState.loadingStoredCredentials()); - await onLoadCredentialStore(event); + if (currentState case final CredentialStoreSuccess success) { + emit(success); + } else { + emit(const CredentialStoreState.loadingStoredCredentials()); + await onLoadCredentialStore(event); + } case CredentialStoreStoreCredentials _: emit(const CredentialStoreState.storingCredentials()); await onStoreCredentials(event);