Skip to content

Commit 449bdf1

Browse files
committed
fix(taro-weapp): 微信小程序循环 ref 在更新时逻辑优化
1 parent 8da65f9 commit 449bdf1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/taro-transformer-wx/src/render.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ export class RenderParser {
16651665
this.renderPath.node.body.body.unshift(
16661666
template(`this.__state = arguments[0] || this.state || {};`)(),
16671667
template(`this.__props = arguments[1] || this.props || {};`)(),
1668-
template(`const __runloopRef = arguments[2] || true;`)(),
1668+
template(`const __runloopRef = arguments[2];`)(),
16691669
this.usedThisProperties.size
16701670
? t.variableDeclaration(
16711671
'const',

packages/taro-weapp/src/lifecycle.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ function doUpdate (component, prevProps, prevState) {
6262
let data = state || {}
6363
if (component._createData) {
6464
// 返回null或undefined则保持不变
65-
const runloopRef = !component.__mounted
66-
data = component._createData(state, props, runloopRef) || data
65+
const runLoopRef = !component.__mounted
66+
data = component._createData(state, props, runLoopRef) || data
6767
}
6868
let privatePropKeyVal = component.$scope.data[privatePropKeyName] || false
6969

@@ -119,7 +119,7 @@ function doUpdate (component, prevProps, prevState) {
119119
}
120120

121121
if (component['$$hasLoopRef']) {
122-
component._createData(component.state, component.props)
122+
component._createData(component.state, component.props, true)
123123
}
124124

125125
if (typeof component.componentDidUpdate === 'function') {

0 commit comments

Comments
 (0)