Skip to content

Commit

Permalink
Use setState to set highlightedLink
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcaldas committed Aug 7, 2019
1 parent 8b92abe commit 840c436
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/graph/Graph.jsx
Expand Up @@ -271,8 +271,9 @@ export default class Graph extends React.Component {
// return in UPPERCASE, but chrome returns lowercase
const tagName = e.target && e.target.tagName;
const name = e.target && e.target.attributes && e.target.attributes.name && e.target.attributes.name.value;
const svgContainerName = `svg-container-${this.state.id}`;

if (tagName.toUpperCase() === "SVG" && name === `svg-container-${this.state.id}`) {
if (tagName.toUpperCase() === "SVG" && name === svgContainerName) {
this.props.onClickGraph && this.props.onClickGraph();
}
};
Expand Down Expand Up @@ -348,9 +349,9 @@ export default class Graph extends React.Component {
this.props.onMouseOverLink && this.props.onMouseOverLink(source, target);

if (this.state.config.linkHighlightBehavior) {
this.state.highlightedLink = { source, target };
const highlightedLink = { source, target };

this._tick();
this._tick({ highlightedLink });
}
};

Expand All @@ -364,9 +365,9 @@ export default class Graph extends React.Component {
this.props.onMouseOutLink && this.props.onMouseOutLink(source, target);

if (this.state.config.linkHighlightBehavior) {
this.state.highlightedLink = undefined;
const highlightedLink = undefined;

this._tick();
this._tick({ highlightedLink });
}
};

Expand Down

0 comments on commit 840c436

Please sign in to comment.