From 1a71a14319da73299f49984a37181edbd146498e Mon Sep 17 00:00:00 2001 From: Aswath K Date: Thu, 29 Sep 2022 11:25:56 +0530 Subject: [PATCH] fix: Re-selecting dropdown value triggers evaluation cycle (#16201) --- .../propertyControls/ActionSelectorControl.tsx | 3 ++- .../src/components/propertyControls/BaseControl.tsx | 12 +++++++++++- .../widget/propertyConfig/PanelConfig/General.ts | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/client/src/components/propertyControls/ActionSelectorControl.tsx b/app/client/src/components/propertyControls/ActionSelectorControl.tsx index 9855dee657..f13ee6f164 100644 --- a/app/client/src/components/propertyControls/ActionSelectorControl.tsx +++ b/app/client/src/components/propertyControls/ActionSelectorControl.tsx @@ -39,7 +39,8 @@ class ActionSelectorControl extends BaseControl { }; handleValueUpdate = (newValue: string, isUpdatedViaKeyboard = false) => { - const { propertyName } = this.props; + const { propertyName, propertyValue } = this.props; + if (!propertyValue && !newValue) return; this.updateProperty(propertyName, newValue, isUpdatedViaKeyboard); }; diff --git a/app/client/src/components/propertyControls/BaseControl.tsx b/app/client/src/components/propertyControls/BaseControl.tsx index 6b5df2baaa..5fd5d2cc6b 100644 --- a/app/client/src/components/propertyControls/BaseControl.tsx +++ b/app/client/src/components/propertyControls/BaseControl.tsx @@ -15,12 +15,22 @@ class BaseControl

extends Component { propertyValue: any, isUpdatedViaKeyboard?: boolean, ) { - if (!_.isNil(this.props.onPropertyChange)) + if ( + this.props.propertyValue === undefined && + propertyValue === this.props.defaultValue + ) { + return; + } + if ( + !_.isNil(this.props.onPropertyChange) && + this.props.propertyValue !== propertyValue + ) { this.props.onPropertyChange( propertyName, propertyValue, isUpdatedViaKeyboard, ); + } } deleteProperties(propertyPaths: string[]) { if (this.props.deleteProperties) { diff --git a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/General.ts b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/General.ts index f4c6c622f9..4b2e131199 100644 --- a/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/General.ts +++ b/app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/General.ts @@ -81,7 +81,7 @@ export default { dependencies: ["primaryColumns", "columnType"], label: "Cell Wrapping", helpText: "Allows content of the cell to be wrapped", - defaultValue: true, + defaultValue: false, controlType: "SWITCH", customJSControl: "TABLE_COMPUTE_VALUE", isJSConvertible: true,