Skip to content

Commit 7325807

Browse files
committed
don't change 'plotly_selected' shiny input if event data is falsy. Closes #1121. Closes #1122
1 parent e266a3c commit 7325807

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

inst/htmlwidgets/plotly.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,12 @@ HTMLWidgets.widget({
289289
);
290290
});
291291
graphDiv.on('plotly_selected', function(d) {
292-
Shiny.onInputChange(
293-
".clientValue-plotly_selected-" + x.source,
294-
JSON.stringify(eventDataWithKey(d))
295-
);
292+
if (d) {
293+
Shiny.onInputChange(
294+
".clientValue-plotly_selected-" + x.source,
295+
JSON.stringify(eventDataWithKey(d))
296+
);
297+
}
296298
});
297299
graphDiv.on('plotly_unhover', function(eventData) {
298300
Shiny.onInputChange(".clientValue-plotly_hover-" + x.source, null);

0 commit comments

Comments
 (0)