From 25efcb20a8a815a4f18761d0180fd51f26b66584 Mon Sep 17 00:00:00 2001 From: Daniel Gaull <98419036+rhit-gaulldj@users.noreply.github.com> Date: Tue, 12 Nov 2024 11:55:28 -0500 Subject: [PATCH] fix cardinality issue (#1136) - Addresses #1118 - Re-reads values from previous state if new cardinality is less than current cardinality --- packages/core/modules/utils/validation.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/modules/utils/validation.js b/packages/core/modules/utils/validation.js index e40e49654..61911afdc 100644 --- a/packages/core/modules/utils/validation.js +++ b/packages/core/modules/utils/validation.js @@ -1383,19 +1383,19 @@ export const getNewValueForFieldOp = function ( // build new values let newValue = currentValue; - if (valueFixes.length > 0 || !canReuseValue) { + if (valueFixes.length > 0 || !canReuseValue || operatorCardinality < currentOperatorCardinality) { newValue = new Immutable.List(Array.from({length: operatorCardinality}, (_ignore, i) => { return valueFixes[i] !== undefined ? valueFixes[i] : (canReuseValue ? currentValue.get(i) : undefined); })); } let newValueSrc = currentValueSrc; - if (valueSrcFixes.length > 0 || !canReuseValue) { + if (valueSrcFixes.length > 0 || !canReuseValue || operatorCardinality < currentOperatorCardinality) { newValueSrc = new Immutable.List(Array.from({length: operatorCardinality}, (_ignore, i) => { return valueSrcFixes[i] ?? (canReuseValue && currentValueSrc.get(i) || null); })); } let newValueType = currentValueType; - if (valueTypeFixes.length > 0 || !canReuseValue) { + if (valueTypeFixes.length > 0 || !canReuseValue || operatorCardinality < currentOperatorCardinality) { newValueType = new Immutable.List(Array.from({length: operatorCardinality}, (_ignore, i) => { return valueTypeFixes[i] ?? (canReuseValue && currentValueType.get(i) || null); }));