From 18b933558b82c1a54568d979343db04e78ea3530 Mon Sep 17 00:00:00 2001 From: Simona Domnisoru Date: Thu, 25 Apr 2024 09:52:27 +0200 Subject: [PATCH] chore: linter --- .../components/D2Form/FormBuilder/FormBuilder.component.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core_modules/capture-core/components/D2Form/FormBuilder/FormBuilder.component.js b/src/core_modules/capture-core/components/D2Form/FormBuilder/FormBuilder.component.js index 9e7a5148da..6707d84ca7 100644 --- a/src/core_modules/capture-core/components/D2Form/FormBuilder/FormBuilder.component.js +++ b/src/core_modules/capture-core/components/D2Form/FormBuilder/FormBuilder.component.js @@ -265,7 +265,6 @@ export class FormBuilder extends React.Component { ); } - fieldInstances: Map; asyncUIState: { [id: string]: FieldUI }; fieldsValidatingPromiseContainer: FieldsValidatingPromiseContainer; @@ -299,12 +298,13 @@ export class FormBuilder extends React.Component { componentDidUpdate(prevProps: Props) { const { fieldsUI, fields } = this.props; + if (!isEqual(prevProps.fieldsUI, fieldsUI)) { const pendingValidationFields = Object.keys(fieldsUI).filter(key => fieldsUI[key].pendingValidation); if (pendingValidationFields.length !== 0 && !this.validateAllCancelablePromise) { - const customFields = fields.filter(field => pendingValidationFields.includes(field.id)); - this.validateFields(this.props, customFields); + const fieldsToValidate = fields.filter(field => pendingValidationFields.includes(field.id)); + this.validateFields(this.props, fieldsToValidate); } } }