Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

 #2287 Fixed Common properties callbacks don't update on re-render #2288

Merged
merged 3 commits into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading