Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/AltContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ class AltContainer extends React.Component {
throw new ReferenceError('Cannot define both store and stores')
}

this.storeListeners = []

this.state = reduceState(props)
}

Expand Down Expand Up @@ -179,15 +177,16 @@ class AltContainer extends React.Component {
}

_destroySubscriptions() {
this.storeListeners.forEach(storeListener => storeListener())
const stores = this.props.stores
stores && stores.forEach(store => store.unlisten(this.altSetState))
}

_addSubscription(getStore) {
const store = typeof getStore === 'function'
? getStore(this.props).store
: getStore

this.storeListeners.push(store.listen(this.altSetState))
store.listen(this.altSetState)
}

altSetState = () => {
Expand Down