Skip to content

Commit

Permalink
Merge pull request #22781 from hoangzinh/df/22037
Browse files Browse the repository at this point in the history
Fix change language also trigger submit Sign in validation form when magic codes are fullfilled
  • Loading branch information
mountiny authored Jul 14, 2023
2 parents 0b00e1c + ec2fd2e commit df2e3eb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/MagicCodeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ function MagicCodeInput(props) {
useEffect(() => {
validateAndSubmit();

// We have not added the editIndex as the dependency because we don't want to run this logic after focusing on an input to edit it after the user has completed the code.
// We have not added:
// + the editIndex as the dependency because we don't want to run this logic after focusing on an input to edit it after the user has completed the code.
// + the props.onFulfill as the dependency because props.onFulfill is changed when the preferred locale changed => avoid auto submit form when preferred locale changed.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.value, props.shouldSubmitOnComplete, props.onFulfill]);
}, [props.value, props.shouldSubmitOnComplete]);

useEffect(() => {
if (!props.autoFocus) {
Expand Down

0 comments on commit df2e3eb

Please sign in to comment.