Skip to content

Commit

Permalink
fix(taro-weapp/qq/swan/tt): 修复小程序新 props 系统不触发 componentWillReceive 的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Apr 30, 2019
1 parent 3abdd52 commit a34687d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
8 changes: 5 additions & 3 deletions packages/taro-qq/src/propsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ class Manager {

const nextProps = filterProps(ComponentClass.defaultProps, props, component.props)
component.props = nextProps
component._unsafeCallUpdate = true
nextTick(() => updateComponent(component))
component._unsafeCallUpdate = false
nextTick(() => {
component._unsafeCallUpdate = true
updateComponent(component)
component._unsafeCallUpdate = false
})
}
})
}
Expand Down
8 changes: 5 additions & 3 deletions packages/taro-swan/src/propsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ class Manager {

const nextProps = filterProps(ComponentClass.defaultProps, props, component.props)
component.props = nextProps
component._unsafeCallUpdate = true
nextTick(() => updateComponent(component))
component._unsafeCallUpdate = false
nextTick(() => {
component._unsafeCallUpdate = true
updateComponent(component)
component._unsafeCallUpdate = false
})
}
})
}
Expand Down
8 changes: 5 additions & 3 deletions packages/taro-tt/src/propsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ class Manager {

const nextProps = filterProps(ComponentClass.defaultProps, props, component.props)
component.props = nextProps
component._unsafeCallUpdate = true
nextTick(() => updateComponent(component))
component._unsafeCallUpdate = false
nextTick(() => {
component._unsafeCallUpdate = true
updateComponent(component)
component._unsafeCallUpdate = false
})
}
})
}
Expand Down
8 changes: 5 additions & 3 deletions packages/taro-weapp/src/propsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ class Manager {

const nextProps = filterProps(ComponentClass.defaultProps, props, component.props)
component.props = nextProps
component._unsafeCallUpdate = true
nextTick(() => updateComponent(component))
component._unsafeCallUpdate = false
nextTick(() => {
component._unsafeCallUpdate = true
updateComponent(component)
component._unsafeCallUpdate = false
})
}
})
}
Expand Down

0 comments on commit a34687d

Please sign in to comment.