Skip to content

Commit fbb89ae

Browse files
committed
bind proper store context in connectAdvanced and the Subscription util
1 parent edb93bd commit fbb89ae

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/components/connectAdvanced.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ export default function connectAdvanced(
159159
}
160160

161161
initSelector() {
162-
const { dispatch, getState } = this.store
162+
const { dispatch } = this.store
163+
let getState = this.store.getState.bind(this.store)
163164
const sourceSelector = selectorFactory(dispatch, selectorFactoryOptions)
164165

165166
// wrap the selector in an object that tracks its results between runs

src/utils/Subscription.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default class Subscription {
55
constructor(store, parentSub) {
66
this.subscribe = parentSub
77
? parentSub.addNestedSub.bind(parentSub)
8-
: store.subscribe
8+
: store.subscribe.bind(store)
99

1010
this.unsubscribe = null
1111
this.nextListeners = this.currentListeners = []

0 commit comments

Comments
 (0)