From 568375774f58849e94bb5fdca84ea78ba7a4a870 Mon Sep 17 00:00:00 2001 From: Tony Valle Date: Sat, 22 Aug 2026 13:52:21 +0200 Subject: [PATCH] fix: comparison between the new and the cached rule messages --- i18n/en.pot | 4 ++-- .../D2Form/FormBuilder/FormBuilder.component.tsx | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/i18n/en.pot b/i18n/en.pot index 0f63daf93d..caca3f7e10 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -5,8 +5,8 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" -"POT-Creation-Date: 2026-08-21T07:54:23.258Z\n" -"PO-Revision-Date: 2026-08-21T07:54:23.258Z\n" +"POT-Creation-Date: 2026-08-22T11:52:21.267Z\n" +"PO-Revision-Date: 2026-08-22T11:52:21.267Z\n" msgid "The application could not be loaded." msgstr "The application could not be loaded." diff --git a/src/core_modules/capture-core/components/D2Form/FormBuilder/FormBuilder.component.tsx b/src/core_modules/capture-core/components/D2Form/FormBuilder/FormBuilder.component.tsx index 4d5e6b57c3..21d3351171 100644 --- a/src/core_modules/capture-core/components/D2Form/FormBuilder/FormBuilder.component.tsx +++ b/src/core_modules/capture-core/components/D2Form/FormBuilder/FormBuilder.component.tsx @@ -6,6 +6,7 @@ import { makeCancelablePromise } from 'capture-core-utils'; import isDefined from 'd2-utilizr/lib/isDefined'; import isObject from 'd2-utilizr/lib/isObject'; import { FormField, FormPlugin } from './components'; +import { messageStateKeys } from '../../../reducers/descriptions/rulesEffects.reducerDescription'; import type { PostProcessErrorMessage, FieldConfig, @@ -489,11 +490,11 @@ export class FormBuilder extends React.Component { return ruleMessage; } - if (Object.keys(ruleMessage).some((key) => { + if (Object.values(messageStateKeys).some((key) => { const currentMessage = ruleMessage[key]; const prevMessage = prevRuleMessage[key]; - if (Array.isArray(currentMessage)) { - if (!Array.isArray(prevMessage) || prevMessage.length !== currentMessage.length) { + if (Array.isArray(currentMessage) && Array.isArray(prevMessage)) { + if (prevMessage.length !== currentMessage.length) { return true; } return currentMessage.some((value, index) => value !== prevMessage[index]);