Skip to content

Commit

Permalink
fix(taro-weapp): 微信小程序循环 ref 在更新时逻辑优化
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Feb 19, 2019
1 parent 8da65f9 commit 449bdf1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/taro-transformer-wx/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ export class RenderParser {
this.renderPath.node.body.body.unshift(
template(`this.__state = arguments[0] || this.state || {};`)(),
template(`this.__props = arguments[1] || this.props || {};`)(),
template(`const __runloopRef = arguments[2] || true;`)(),
template(`const __runloopRef = arguments[2];`)(),
this.usedThisProperties.size
? t.variableDeclaration(
'const',
Expand Down
6 changes: 3 additions & 3 deletions packages/taro-weapp/src/lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ function doUpdate (component, prevProps, prevState) {
let data = state || {}
if (component._createData) {
// 返回null或undefined则保持不变
const runloopRef = !component.__mounted
data = component._createData(state, props, runloopRef) || data
const runLoopRef = !component.__mounted
data = component._createData(state, props, runLoopRef) || data
}
let privatePropKeyVal = component.$scope.data[privatePropKeyName] || false

Expand Down Expand Up @@ -119,7 +119,7 @@ function doUpdate (component, prevProps, prevState) {
}

if (component['$$hasLoopRef']) {
component._createData(component.state, component.props)
component._createData(component.state, component.props, true)
}

if (typeof component.componentDidUpdate === 'function') {
Expand Down

0 comments on commit 449bdf1

Please sign in to comment.