From dfe5151f7f8292d48702dd57071424be36dbf6f8 Mon Sep 17 00:00:00 2001 From: Alex Florisca Date: Fri, 26 Aug 2022 16:33:31 +0100 Subject: [PATCH] Fix payment status being set to pristine not working correctly --- .../assets/js/data/payment-methods/reducers.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce-blocks/assets/js/data/payment-methods/reducers.ts b/plugins/woocommerce-blocks/assets/js/data/payment-methods/reducers.ts index d387e051818..d895a92c54e 100644 --- a/plugins/woocommerce-blocks/assets/js/data/payment-methods/reducers.ts +++ b/plugins/woocommerce-blocks/assets/js/data/payment-methods/reducers.ts @@ -37,7 +37,11 @@ const reducer: Reducer< PaymentMethodDataState > = ( newState = { ...state, currentStatus: { - ...state.currentStatus, + // When the status is changed to pristine, we need to reset the currentStatus properties + // to their default initial values + ...( action.status?.isPristine === true + ? defaultPaymentMethodDataState.currentStatus + : state.currentStatus ), ...action.status, isFinished: action.status.hasError ||