From bdcf8973fa7e63c2ce0d3d3b02dade9693fe7eca Mon Sep 17 00:00:00 2001 From: Garth Poitras Date: Thu, 6 Jul 2017 09:43:48 -0400 Subject: [PATCH] Don't mutate Connect's setWrappedInstance method --- src/components/connectAdvanced.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/connectAdvanced.js b/src/components/connectAdvanced.js index 54ffa477c..be5dd37c2 100644 --- a/src/components/connectAdvanced.js +++ b/src/components/connectAdvanced.js @@ -121,7 +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) + this.setWrappedInstanceBound = this.setWrappedInstance.bind(this) invariant(this.store, `Could not find "${storeKey}" in either the context or props of ` + @@ -240,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 + if (withRef) withExtras.ref = this.setWrappedInstanceBound if (renderCountProp) withExtras[renderCountProp] = this.renderCount++ if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription return withExtras