Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd63424

Browse filesBrowse files
committed
fix error on clearing crosstalk selection
1 parent 01582b8 commit cd63424
Copy full SHA for cd63424

File tree

2 files changed

+6
-4
lines changed
Filter options

2 files changed

+6
-4
lines changed

‎NEWS.md

Copy file name to clipboardExpand all lines: NEWS.md
+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* `ggplotly()` now respects `guide(aes = "none")` (e.g., `guide(fill = "none")`) when constructing legend entries. (#2067)
1717
* Fixed an issue with translating `GGally::ggcorr()` via `ggplotly()`. (#2012)
1818
* Fixed an issue where clearing a crosstalk filter would raise an error in the JS console (#2087)
19+
* Fixed an issue with `{crosstalk}` where running `selectionHandle.clear()` from another visual causes plotly to throw an error. (#2098)
20+
1921

2022
## Improvements
2123

‎inst/htmlwidgets/plotly.js

Copy file name to clipboardExpand all lines: 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.