From 88f8295ab7290a9cab1dc106014fd63a8b6bc8f0 Mon Sep 17 00:00:00 2001 From: Mohammed Saud Date: Fri, 28 Jul 2023 21:27:00 +0530 Subject: [PATCH] touch detection fields if detection succeedes --- .../ImportForm/ReviewSection/RuntimeSelector.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/ImportForm/ReviewSection/RuntimeSelector.tsx b/src/components/ImportForm/ReviewSection/RuntimeSelector.tsx index 133a26f3b..8125c2277 100644 --- a/src/components/ImportForm/ReviewSection/RuntimeSelector.tsx +++ b/src/components/ImportForm/ReviewSection/RuntimeSelector.tsx @@ -190,9 +190,11 @@ export const RuntimeSelector: React.FC = ({ detectedCompon setFieldError(`${fieldPrefix}.runtime`, detectionError); } else if (detectionLoaded && detectedComponents) { setDetecting(false); + setFieldValue('isDetected', true); + setFieldValue('detectionFailed', false); // To avoid formik validating on old values due to a formik bug - https://github.com/jaredpalmer/formik/issues/2083 - setTimeout(() => setFieldValue('isDetected', true)); - setTimeout(() => setFieldValue('detectionFailed', false)); + setTimeout(() => setFieldTouched('isDetected', true)); + setTimeout(() => setFieldTouched('detectionFailed', true)); const componentValues = transformComponentValues( detectedComponents, originalComponentRef.current, @@ -208,6 +210,7 @@ export const RuntimeSelector: React.FC = ({ detectedCompon detectionLoaded, fieldPrefix, setFieldError, + setFieldTouched, setFieldValue, sourceUrl, ]);