Skip to content

Commit

Permalink
Added setCallbacks method
Browse files Browse the repository at this point in the history
Signed-off-by: Neha Gokhale <[email protected]>
  • Loading branch information
nmgokhale committed Jan 3, 2025
1 parent b7fcd39 commit d13ea59
Showing 1 changed file with 16 additions and 22 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 @@ -145,17 +135,7 @@ class PropertiesMain extends React.Component {

componentDidUpdate(prevProps) {
if (!isEqual(prevProps.callbacks, this.props.callbacks)) {
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,
});
this.setCallbacks();
}
}

Expand All @@ -169,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 d13ea59

Please sign in to comment.