Skip to content

Commit

Permalink
fix(taro-weapp): 页面执行完 componentWillReceiveProps 后需要更新下 state
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jun 22, 2018
1 parent c0d91fb commit ad9c05e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/taro-weapp/src/lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ export function updateComponent (component, update) {
const displayName = type.name || type.toString().match(/^function\s*([^\s(]+)/)[1]
PropTypes.checkPropTypes(propTypes, props, 'prop', displayName)
}
let state = component.getState()
if (component._createData) {
state = component._createData(state)
}
state.__data && (state.__data.$path = component.$path)
const prevProps = component.prevProps || props
const prevState = component.prevState || state
component.props = prevProps
if (component._unsafeCallUpdate === true && component.componentWillReceiveProps) {
component._disable = true
component.componentWillReceiveProps(props)
component._disable = false
}
let state = component.getState()
if (component._createData) {
state = component._createData(state)
}
state.__data && (state.__data.$path = component.$path)
const prevState = component.prevState || state
let skip = false
if (typeof component.shouldComponentUpdate === 'function' &&
component.shouldComponentUpdate(props, state) === false) {
Expand Down

0 comments on commit ad9c05e

Please sign in to comment.