Skip to content

Commit

Permalink
Merge pull request #5944 from formio/FIO-8862-fixed-unnecessary-redra…
Browse files Browse the repository at this point in the history
…wings-of-value-component-in-conditional-ui

FIO-8862: fixed unnecessary redrawings of the value component in conditional ui
  • Loading branch information
brendanbond authored Dec 12, 2024
2 parents 74aadbb + 74e70b0 commit 93df2b5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/editgrid/EditGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,16 @@ export default class EditGridComponent extends NestedArrayComponent {

checkRowVariableTypeComponents(editRow, rowIndex) {
const rowComponents = editRow.components;
let typeChanged = false;

if (_.some(this.variableTypeComponentsIndexes, (compIndex) => {
const variableTypeComp = rowComponents[compIndex];
return variableTypeComp.type !== variableTypeComp.component.type;
})) {
editRow.components = this.createRowComponents(editRow.data, rowIndex, true);
typeChanged = true;
}
return typeChanged;
}

setVariableTypeComponents() {
Expand Down Expand Up @@ -1121,8 +1124,10 @@ export default class EditGridComponent extends NestedArrayComponent {
}

if (this.variableTypeComponentsIndexes.length) {
this.checkRowVariableTypeComponents(editRow, rowIndex);
this.redraw();
const typeChanged = this.checkRowVariableTypeComponents(editRow, rowIndex);
if (typeChanged) {
this.redraw();
}
}
};

Expand Down

0 comments on commit 93df2b5

Please sign in to comment.