Skip to content

Commit

Permalink
Move ref context binding to fix object freezing middleware (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garth Poitras authored and timdorr committed Jul 6, 2017
1 parent 2726c59 commit 2118893
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/components/connectAdvanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ 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 ` +
Expand Down Expand Up @@ -240,7 +239,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.setWrappedInstance.bind(this)
if (renderCountProp) withExtras[renderCountProp] = this.renderCount++
if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription
return withExtras
Expand Down

0 comments on commit 2118893

Please sign in to comment.