From 464830fd9d09925a8a99d2d96e65955ef6de6373 Mon Sep 17 00:00:00 2001 From: Jack Anderson Date: Thu, 19 Sep 2024 09:43:16 +0100 Subject: [PATCH] Fix #478 - Add check for 'onFieldInitialize' --- .../lib/fields/field-logic/field-logic.manager.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/app/core/src/lib/fields/field-logic/field-logic.manager.ts b/core/app/core/src/lib/fields/field-logic/field-logic.manager.ts index ee98d98f7..2a536a5b6 100644 --- a/core/app/core/src/lib/fields/field-logic/field-logic.manager.ts +++ b/core/app/core/src/lib/fields/field-logic/field-logic.manager.ts @@ -188,12 +188,18 @@ export class FieldLogicManager extends BaseActionManager { let actionTriggeringStatus = action?.triggeringStatus ?? frontendActionTriggeringStatus ?? defaultTriggeringStatus; - if (triggeringStatus && !actionTriggeringStatus.includes(triggeringStatus)) { + if (actionTriggeringStatus.includes('onValueChange')) { + actionTriggeringStatus = actionTriggeringStatus.filter(value => value !== 'onValueChange'); + actionTriggeringStatus = ['onAnyLogic', ...actionTriggeringStatus]; + } + + if (actionTriggeringStatus.includes('onAnyLogic') && triggeringStatus !== 'onFieldInitialize') { + actions.push(action); return; } - if (actionTriggeringStatus.includes('onValueChange')) { - actionTriggeringStatus = ['onAnyLogic']; + if (triggeringStatus && !actionTriggeringStatus.includes(triggeringStatus)) { + return; } if (actionTriggeringStatus.includes('onDependencyChange') && !dependentFieldsKeys?.includes(fieldDependent.name)) {