From ed835752bc9f632e91c747565a88e07c9b2d6179 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 26 May 2016 13:51:51 +0100 Subject: [PATCH] Hopefully fix memory leak with velocity --- src/Velociraptor.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Velociraptor.js b/src/Velociraptor.js index ad12d1323b..bad921c8c4 100644 --- a/src/Velociraptor.js +++ b/src/Velociraptor.js @@ -25,6 +25,10 @@ module.exports = React.createClass({ this._updateChildren(this.props.children); }, + componentWillUnmount: function() { + this._updateChildren([]); + }, + componentWillReceiveProps: function(nextProps) { this._updateChildren(nextProps.children); }, @@ -106,6 +110,9 @@ module.exports = React.createClass({ }); //console.log("enter: "+JSON.stringify(node.props._restingStyle)); + } else if (node === null) { + // https://github.com/julianshapiro/velocity/issues/300 + Velocity.Utilities.removeData(this.nodes[k]); } this.nodes[k] = node; },