From 2777af34320c9c231b018174999557584192f41c Mon Sep 17 00:00:00 2001 From: joh42 <138504087+joh42@users.noreply.github.com> Date: Fri, 28 Jul 2023 10:34:12 +0200 Subject: [PATCH 1/3] Fixed regression from PR 23306 --- src/components/Form.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Form.js b/src/components/Form.js index ffcd3cbe8cd5..ba6b571dc43c 100644 --- a/src/components/Form.js +++ b/src/components/Form.js @@ -147,7 +147,10 @@ function Form(props) { setErrors(touchedInputErrors); } - lastValidatedValues.current = values; + const atLeastOneInputTouched = _.keys(touchedInputs.current).length > 0 + if (atLeastOneInputTouched) { + lastValidatedValues.current = values; + } return touchedInputErrors; }, From 873e2a62b929db0b9cfbcbee227c46ef5fb7f8e9 Mon Sep 17 00:00:00 2001 From: joh42 <138504087+joh42@users.noreply.github.com> Date: Fri, 28 Jul 2023 10:45:37 +0200 Subject: [PATCH 2/3] Corrected variable naming --- src/components/Form.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Form.js b/src/components/Form.js index ba6b571dc43c..9f93046b5d44 100644 --- a/src/components/Form.js +++ b/src/components/Form.js @@ -147,8 +147,8 @@ function Form(props) { setErrors(touchedInputErrors); } - const atLeastOneInputTouched = _.keys(touchedInputs.current).length > 0 - if (atLeastOneInputTouched) { + const isAtLeastOneInputTouched = _.keys(touchedInputs.current).length > 0 + if (isAtLeastOneInputTouched) { lastValidatedValues.current = values; } From f850a6011a53a7700dacdd942aa07100d7bc6dda Mon Sep 17 00:00:00 2001 From: joh42 <138504087+joh42@users.noreply.github.com> Date: Fri, 28 Jul 2023 10:46:38 +0200 Subject: [PATCH 3/3] added semicolon --- src/components/Form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Form.js b/src/components/Form.js index 9f93046b5d44..3ea5c13d68f4 100644 --- a/src/components/Form.js +++ b/src/components/Form.js @@ -147,7 +147,7 @@ function Form(props) { setErrors(touchedInputErrors); } - const isAtLeastOneInputTouched = _.keys(touchedInputs.current).length > 0 + const isAtLeastOneInputTouched = _.keys(touchedInputs.current).length > 0; if (isAtLeastOneInputTouched) { lastValidatedValues.current = values; }