Skip to content

Commit

Permalink
 #2287 Fixed Common properties callbacks don't update on re-render (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nmgokhale authored Jan 3, 2025
1 parent 687f337 commit c4b5827
Showing 1 changed file with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,7 @@ class PropertiesMain extends React.Component {
this.propertiesController.setLight(props.light);
this.propertiesController.setAppData(props.propertiesInfo.appData);
this.propertiesController.setExpressionInfo(props.propertiesInfo.expressionInfo);
this.propertiesController.setHandlers({
controllerHandler: props.callbacks.controllerHandler,
propertyListener: props.callbacks.propertyListener,
actionHandler: props.callbacks.actionHandler,
buttonHandler: props.callbacks.buttonHandler,
buttonIconHandler: props.callbacks.buttonIconHandler,
validationHandler: props.callbacks.validationHandler,
titleChangeHandler: props.callbacks.titleChangeHandler,
tooltipLinkHandler: props.callbacks.tooltipLinkHandler,
propertyIconHandler: props.callbacks.propertyIconHandler,
});
this.setCallbacks();
this.setForm(props.propertiesInfo, false);
this.previousErrorMessages = {};
// this has to be after setForm because setForm clears all error messages.
Expand Down Expand Up @@ -143,6 +133,12 @@ class PropertiesMain extends React.Component {
}
}

componentDidUpdate(prevProps) {
if (!isEqual(prevProps.callbacks, this.props.callbacks)) {
this.setCallbacks();
}
}

onBlur(e) {
// apply properties when focus leave common properties.
// subdialogs and summary panel causes focus to leave but shouldn't apply settings
Expand All @@ -153,6 +149,20 @@ class PropertiesMain extends React.Component {
}
}

setCallbacks() {
this.propertiesController.setHandlers({
controllerHandler: this.props.callbacks.controllerHandler,
propertyListener: this.props.callbacks.propertyListener,
actionHandler: this.props.callbacks.actionHandler,
buttonHandler: this.props.callbacks.buttonHandler,
buttonIconHandler: this.props.callbacks.buttonIconHandler,
validationHandler: this.props.callbacks.validationHandler,
titleChangeHandler: this.props.callbacks.titleChangeHandler,
tooltipLinkHandler: this.props.callbacks.tooltipLinkHandler,
propertyIconHandler: this.props.callbacks.propertyIconHandler,
});
}

setForm(propertiesInfo, sameParameterDefRendered) {
let formData = null;

Expand Down

0 comments on commit c4b5827

Please sign in to comment.