From b31660253398ce10bde3d344feac03148a99185d Mon Sep 17 00:00:00 2001 From: Neha Gokhale Date: Thu, 26 Dec 2024 14:50:59 -0800 Subject: [PATCH 1/3] =?UTF-8?q?=C2=A0#2287=20Fixed=20Common=20properties?= =?UTF-8?q?=20callbacks=20don't=20update=20on=20re-render?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Neha Gokhale --- .../properties-main/properties-main.jsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx b/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx index 26b8d8ad4..b9311a924 100644 --- a/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx +++ b/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx @@ -109,6 +109,22 @@ class PropertiesMain extends React.Component { this.props.callbacks.setPropertiesHasMounted(); } + 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, + }); + } + } + UNSAFE_componentWillReceiveProps(newProps) { // eslint-disable-line camelcase, react/sort-comp if (this.props.light !== newProps.light) { // set the new light prop in controller this.propertiesController.setLight(newProps.light); From b7fcd39f78ac78c5cd3c000c9d579f9aadda1db6 Mon Sep 17 00:00:00 2001 From: Neha Gokhale Date: Thu, 26 Dec 2024 16:37:32 -0800 Subject: [PATCH 2/3] Fix build Signed-off-by: Neha Gokhale --- .../properties-main/properties-main.jsx | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx b/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx index b9311a924..5bb950dd1 100644 --- a/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx +++ b/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx @@ -109,22 +109,6 @@ class PropertiesMain extends React.Component { this.props.callbacks.setPropertiesHasMounted(); } - 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, - }); - } - } - UNSAFE_componentWillReceiveProps(newProps) { // eslint-disable-line camelcase, react/sort-comp if (this.props.light !== newProps.light) { // set the new light prop in controller this.propertiesController.setLight(newProps.light); @@ -159,6 +143,22 @@ 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, + }); + } + } + onBlur(e) { // apply properties when focus leave common properties. // subdialogs and summary panel causes focus to leave but shouldn't apply settings From d13ea597dc0b665e421792c5681f9921cfdfe729 Mon Sep 17 00:00:00 2001 From: Neha Gokhale Date: Fri, 3 Jan 2025 10:51:59 -0800 Subject: [PATCH 3/3] Added setCallbacks method Signed-off-by: Neha Gokhale --- .../properties-main/properties-main.jsx | 38 ++++++++----------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx b/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx index 5bb950dd1..657db29f7 100644 --- a/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx +++ b/canvas_modules/common-canvas/src/common-properties/properties-main/properties-main.jsx @@ -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. @@ -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(); } } @@ -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;