Skip to content

Commit

Permalink
fix lower cardinality not updating tree (ukrbublik#1118)
Browse files Browse the repository at this point in the history
- Addresses ukrbublik#1118
- Re-pulls newValue/newValueSrc/newValueType from previous state when new operator cardinality is less than current operator cardinality
  • Loading branch information
rhit-gaulldj committed Nov 12, 2024
1 parent e691234 commit bf362a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/modules/utils/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}));
Expand Down

0 comments on commit bf362a1

Please sign in to comment.