Skip to content

Commit

Permalink
fix(redux): props传递 && 组件卸载时执行顺序
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Apr 22, 2018
1 parent 0a5b715 commit ec56a1e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/taro-redux/src/connect/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export default function connect (mapStateToProps, mapDispatchToProps) {
let unSubscribe = null
return class Connect extends Component {
constructor () {
super(...arguments)
this.props = Object.assign(this.props, initMapState, initMapDispatch)
super(Object.assign(initMapState, initMapDispatch))
Object.keys(initMapDispatch).forEach(key => {
this[`__event_${key}`] = initMapDispatch[key]
})
Expand All @@ -43,13 +42,13 @@ export default function connect (mapStateToProps, mapDispatchToProps) {
}

componentWillUnmount () {
if (super.componentWillUnmount) {
super.componentWillUnmount()
}
if (unSubscribe) {
unSubscribe()
}
unSubscribe = null
if (super.componentWillUnmount) {
super.componentWillUnmount()
}
}
}
}
Expand Down

0 comments on commit ec56a1e

Please sign in to comment.