Skip to content

Commit

Permalink
fix: Trigger custom click handler in collapsible nodes
Browse files Browse the repository at this point in the history
There was a mistake in the `_tick` method which caused the user's
`onNodeClick` custom handler to never be triggered when the collapsible
feature was enabled.

The problem was that it called `setState` without using a callback
parameter if the received `cb` was not empty. The contents of that
ternary operator should be the opposite for things to work.

This fix closes #136.
  • Loading branch information
LonelyPrincess committed Oct 16, 2018
1 parent 0d59101 commit d0c4ce0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/graph/Graph.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export default class Graph extends React.Component {
* @param {Function} [cb] - optional callback to fed in to {@link setState()|https://reactjs.org/docs/react-component.html#setstate}.
* @returns {undefined}
*/
_tick = (state = {}, cb) => (cb ? this.setState(state) : this.setState(state, cb));
_tick = (state = {}, cb) => (cb ? this.setState(state, cb) : this.setState(state));

/**
* Configures zoom upon graph with default or user provided values.<br/>
Expand Down

0 comments on commit d0c4ce0

Please sign in to comment.