Skip to content

Commit

Permalink
fix(taro-redux): store 变化后被影响的 Component 立即做 setData 更新。防止子组件在 observ…
Browse files Browse the repository at this point in the history
…e 更新的情况下重新计算 props ,从而覆盖掉 redux 修改的 props。fix #1125
  • Loading branch information
Chen-jj committed Nov 22, 2018
1 parent 72637b9 commit 375ab1d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/taro-redux/src/connect/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function isEqual (a, b) {
function wrapPropsWithDispatch (mapDispatchToProps, dispatch) {
if (typeof mapDispatchToProps === 'function') {
return mapDispatchToProps(dispatch)
}
}

if (isObject(mapDispatchToProps)) {
return Object.keys(mapDispatchToProps)
Expand Down Expand Up @@ -57,7 +57,7 @@ export default function connect (mapStateToProps, mapDispatchToProps) {
if (isChanged) {
this.prevProps = prevProps
this._unsafeCallUpdate = true
this.setState({}, () => {
this.forceUpdate(() => {
delete this._unsafeCallUpdate
})
}
Expand Down

0 comments on commit 375ab1d

Please sign in to comment.