Skip to content

Commit

Permalink
fix: variable name state updating
Browse files Browse the repository at this point in the history
  • Loading branch information
abdul99ahad committed Sep 23, 2024
1 parent 436f008 commit 20f1582
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class LiteralExpressionPropertiesComponent extends Component {
this._viewer = context.injector.get('viewer');
this._modeling = context.injector.get('modeling');
this._dataTypes = context.injector.get('dataTypes');

this._eventBus = context.injector.get('eventBus');
const decision = this._viewer.getDecision();

this.state = {
Expand All @@ -32,6 +32,23 @@ export default class LiteralExpressionPropertiesComponent extends Component {
});
}

componentWillMount() {
this._eventBus.on('elements.changed', this.onChange);
}

componentWillUnmount() {
this._eventBus.off('elements.changed', this.onChange);
}

onChange = () => {
const decision = this._viewer.getDecision();
if (decision.variable) {
this.setState({
name: decision.variable.name
});
}
};

setVariableType(typeRef) {
if (typeRef === '') {
this._modeling.editVariableType(undefined);
Expand Down

0 comments on commit 20f1582

Please sign in to comment.