Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
back to isBeforeProcessing
Browse files Browse the repository at this point in the history
  • Loading branch information
senadir committed Aug 9, 2021
1 parent ccae990 commit f767898
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions assets/js/base/components/text-input/validated-text-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const ValidatedTextInput = ( {
getValidationErrorId,
} = useValidationContext();

const { onCheckoutValidationBeforeProcessing } = useCheckoutContext();
const { isBeforeProcessing } = useCheckoutContext();

const textInputId =
typeof id !== 'undefined' ? id : 'textinput-' + instanceId;
Expand Down Expand Up @@ -118,10 +118,10 @@ const ValidatedTextInput = ( {
}, [ isPristine, setIsPristine, validateOnMount, validateInput ] );

useEffect( () => {
const unsubscribe = onCheckoutValidationBeforeProcessing( () => validateInput() );
return unsubscribe;
}, [ onCheckoutValidationBeforeProcessing, validateInput ] );

if ( isBeforeProcessing ) {
validateInput();
}
}, [ isBeforeProcessing, validateInput ] );
// Remove validation errors when unmounted.
useEffect( () => {
return () => {
Expand Down

0 comments on commit f767898

Please sign in to comment.