diff --git a/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/states/CredentialStoreState.kt b/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/states/CredentialStoreState.kt index 2e898502eb..aa8f01647f 100644 --- a/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/states/CredentialStoreState.kt +++ b/aws-auth-cognito/src/main/java/com/amplifyframework/statemachine/codegen/states/CredentialStoreState.kt @@ -64,7 +64,10 @@ internal sealed class CredentialStoreState : State { val action = credentialStoreActions.loadCredentialStoreAction(storeEvent.credentialType) StateResolution(LoadingStoredCredentials(), listOf(action)) } - is CredentialStoreEvent.EventType.ThrowError -> StateResolution(Error(storeEvent.error)) + is CredentialStoreEvent.EventType.ThrowError -> { + val action = credentialStoreActions.moveToIdleStateAction() + StateResolution(Error(storeEvent.error), listOf(action)) + } else -> defaultResolution } is LoadingStoredCredentials, is StoringCredentials, is ClearingCredentials -> when (storeEvent) { @@ -96,8 +99,7 @@ internal sealed class CredentialStoreState : State { } is Success, is Error -> when (storeEvent) { is CredentialStoreEvent.EventType.MoveToIdleState -> { - val action = credentialStoreActions.moveToIdleStateAction() - StateResolution(Idle(), listOf(action)) + StateResolution(Idle(), listOf()) } else -> StateResolution(oldState) }