From d889a01cafd749a99ea5b6d67f8913cc21b451d1 Mon Sep 17 00:00:00 2001 From: Pete Hunt Date: Sun, 16 Mar 2014 21:55:12 -0700 Subject: [PATCH] Fix ref behavior for remounting I'm thinking that setting up `this.refs` in `mountComponent` is better than `construct`. Followed the same pattern as `ReactComponent.Mixin` and nulling out the value in `construct` and setting it to its initial value in `mountComponent`. --- src/core/ReactCompositeComponent.js | 1 - src/core/ReactOwner.js | 4 ---- 2 files changed, 5 deletions(-) diff --git a/src/core/ReactCompositeComponent.js b/src/core/ReactCompositeComponent.js index ffade81194..85e38bb0ff 100644 --- a/src/core/ReactCompositeComponent.js +++ b/src/core/ReactCompositeComponent.js @@ -978,7 +978,6 @@ var ReactCompositeComponentMixin = { this._renderedComponent = null; ReactComponent.Mixin.unmountComponent.call(this); - ReactOwner.Mixin.unmountComponent.call(this); // Some existing components rely on this.props even after they've been // destroyed (in event handlers). diff --git a/src/core/ReactOwner.js b/src/core/ReactOwner.js index 2249157c49..d690f65c9c 100644 --- a/src/core/ReactOwner.js +++ b/src/core/ReactOwner.js @@ -150,10 +150,6 @@ var ReactOwner = { */ detachRef: function(ref) { delete this.refs[ref]; - }, - - unmountComponent: function() { - this.refs = null; } }