only update selection if selectable has changed (#3573)

This commit is contained in:
Deep Tailor 2020-12-02 12:00:30 -08:00 committed by GitHub
parent 1c2b0678be
commit 2e1d57aa8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,11 +70,8 @@ define(
if (multiSelect) {
this.handleMultiSelect(selectable);
} else {
this.setSelectionStyles(selectable);
this.selected = [selectable];
this.handleSingleSelect(selectable);
}
this.emit('change', this.selected);
};
/**
@ -87,6 +84,20 @@ define(
this.addSelectionAttributes(selectable);
this.selected.push(selectable);
}
this.emit('change', this.selected);
};
/**
* @private
*/
Selection.prototype.handleSingleSelect = function (selectable) {
if (!_.isEqual([selectable], this.selected)) {
this.setSelectionStyles(selectable);
this.selected = [selectable];
this.emit('change', this.selected);
}
};
/**