Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #291 from matrix-org/dbkr/velocity_memory_leak
Browse files Browse the repository at this point in the history
Hopefully fix memory leak with velocity
  • Loading branch information
dbkr committed May 26, 2016
2 parents 07cc9bf + 1664f46 commit 0a2d014
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Velociraptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ module.exports = React.createClass({
});

//console.log("enter: "+JSON.stringify(node.props._restingStyle));
} else if (node === null) {
// Velocity stores data on elements using the jQuery .data()
// method, and assumes you'll be using jQuery's .remove() to
// remove the element, but we don't use jQuery, so we need to
// blow away the element's data explicitly otherwise it will leak.
// This uses Velocity's internal jQuery compatible wrapper.
// See the bug at
// https://github.com/julianshapiro/velocity/issues/300
// and the FAQ entry, "Preventing memory leaks when
// creating/destroying large numbers of elements"
// (https://github.com/julianshapiro/velocity/issues/47)
Velocity.Utilities.removeData(this.nodes[k]);
}
this.nodes[k] = node;
},
Expand Down

0 comments on commit 0a2d014

Please sign in to comment.