From bd05362c672016cf90cbe555f1ff579e0b7409ba Mon Sep 17 00:00:00 2001 From: Tim Dorr Date: Thu, 6 Jul 2017 09:40:19 -0400 Subject: [PATCH] Revert "Move ref context binding to fix object freezing middleware (#733)" This reverts commit 21188939b79f959d63f988150dcbadbf1f2379ed. --- src/components/connectAdvanced.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/connectAdvanced.js b/src/components/connectAdvanced.js index 0c03c6121..54ffa477c 100644 --- a/src/components/connectAdvanced.js +++ b/src/components/connectAdvanced.js @@ -121,6 +121,7 @@ export default function connectAdvanced( this.renderCount = 0 this.store = props[storeKey] || context[storeKey] this.propsMode = Boolean(props[storeKey]) + this.setWrappedInstance = this.setWrappedInstance.bind(this) invariant(this.store, `Could not find "${storeKey}" in either the context or props of ` + @@ -239,7 +240,7 @@ export default function connectAdvanced( // instance. a singleton memoized selector would then be holding a reference to the // instance, preventing the instance from being garbage collected, and that would be bad const withExtras = { ...props } - if (withRef) withExtras.ref = this.setWrappedInstance.bind(this) + if (withRef) withExtras.ref = this.setWrappedInstance if (renderCountProp) withExtras[renderCountProp] = this.renderCount++ if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription return withExtras