Skip to content

Commit 237411e

Browse files
committed
fix error on clearing crosstalk selection
1 parent e6cc271 commit 237411e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

inst/htmlwidgets/plotly.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -628,15 +628,15 @@ TraceManager.prototype.updateFilter = function(group, keys) {
628628
};
629629

630630
TraceManager.prototype.updateSelection = function(group, keys) {
631-
632-
if (keys !== null && !Array.isArray(keys)) {
631+
632+
if (keys !== null && keys !== undefined && !Array.isArray(keys)) {
633633
throw new Error("Invalid keys argument; null or array expected");
634634
}
635635

636636
// if selection has been cleared, or if this is transient
637637
// selection, delete the "selection traces"
638638
var nNewTraces = this.gd.data.length - this.origData.length;
639-
if (keys === null || !this.highlight.persistent && nNewTraces > 0) {
639+
if (keys === null || keys === undefined || !this.highlight.persistent && nNewTraces > 0) {
640640
var tracesToRemove = [];
641641
for (var i = 0; i < this.gd.data.length; i++) {
642642
if (this.gd.data[i]._isCrosstalkTrace) tracesToRemove.push(i);
@@ -655,7 +655,7 @@ TraceManager.prototype.updateSelection = function(group, keys) {
655655
}
656656
}
657657

658-
if (keys === null) {
658+
if (keys === null || keys === undefined) {
659659

660660
Plotly.restyle(this.gd, {"opacity": this.origOpacity});
661661

0 commit comments

Comments
 (0)