Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit c50375d

Browse files
committed
Clear the selectedData if the selection box was cleared\nThis partially fixes plotly/dash#97 but depends on plotly/plotly.js#1911 getting fixed
1 parent 1956027 commit c50375d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/components/Graph.react.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
import React, {Component, PropTypes} from 'react';
2-
import {contains, filter, has, type} from 'ramda';
2+
import {contains, filter, has, isNil, type} from 'ramda';
33
/* global Plotly:true */
44

55
const filterEventData = (gd, eventData, event) => {
66
let filteredEventData;
77
if (contains(event, ['click', 'hover', 'selected'])) {
88
const points = [];
99

10+
/*
11+
* On unselect (double-clicking after selecting data),
12+
* the eventData is just `undefined`.
13+
* We're treating a graph with no selection data as having a
14+
* selectionData of `null` to match the initial state of the graph.
15+
*/
16+
if (isNil(eventData)) {
17+
return null;
18+
}
19+
1020
/*
1121
* remove `data`, `layout`, `xaxis`, etc
1222
* objects from the event data since they're so big

0 commit comments

Comments
 (0)