Skip to content

Commit

Permalink
chore: prevent unnecessary variables updates
Browse files Browse the repository at this point in the history
  • Loading branch information
barmac committed Oct 6, 2023
1 parent 6cda9a3 commit d47ebff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/dmn-js-shared/src/components/LiteralExpression.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class LiteralExpression extends Component {
});
}

if (prevProps.variables !== this.props.variables) {
if (!deepEqual(prevProps.variables, this.props.variables)) {
this.editor.setVariables(this.props.variables);
}
}
Expand Down Expand Up @@ -154,3 +154,7 @@ function isCmd(event) {
function isAutocompleteOpen(node) {
return node.querySelector('.cm-tooltip-autocomplete');
}

function deepEqual(a, b) {
return JSON.stringify(a) === JSON.stringify(b);
}

0 comments on commit d47ebff

Please sign in to comment.