fix: Re-selecting dropdown value triggers evaluation cycle (#16201)

This commit is contained in:
Aswath K 2022-09-29 11:25:56 +05:30 committed by GitHub
parent 88fe538a70
commit 1a71a14319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -39,7 +39,8 @@ class ActionSelectorControl extends BaseControl<ControlProps> {
};
handleValueUpdate = (newValue: string, isUpdatedViaKeyboard = false) => {
const { propertyName } = this.props;
const { propertyName, propertyValue } = this.props;
if (!propertyValue && !newValue) return;
this.updateProperty(propertyName, newValue, isUpdatedViaKeyboard);
};

View File

@ -15,12 +15,22 @@ class BaseControl<P extends ControlProps, S = {}> extends Component<P, S> {
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) {

View File

@ -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,