Skip to content

Commit

Permalink
Destroy the Network graph on component unload
Browse files Browse the repository at this point in the history
  • Loading branch information
daliborfilus committed Apr 28, 2022
1 parent 463323a commit da1fd62
Show file tree
Hide file tree
Showing 3 changed files with 3,736 additions and 11 deletions.
10 changes: 10 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ var Graph = function (_Component) {
this.nodes.add(this.props.graph.nodes);
this.updateGraph();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.destroyGraph();
}
}, {
key: "shouldComponentUpdate",
value: function shouldComponentUpdate(nextProps, nextState) {
Expand Down Expand Up @@ -212,6 +217,11 @@ var Graph = function (_Component) {
this.nodes.add(nodesAdded);
this.nodes.update(nodesChanged);
}
}, {
key: "destroyGraph",
value: function destroyGraph() {
if (this.Network) this.Network.destroy();
}
}, {
key: "updateGraph",
value: function updateGraph() {
Expand Down
Loading

0 comments on commit da1fd62

Please sign in to comment.