Skip to content

Commit

Permalink
fix(runtime): 修复custom-wrapper优化失效 (#8599)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerleung0411 authored Feb 3, 2021
1 parent 854ad39 commit 56378b1
Show file tree
Hide file tree
Showing 24 changed files with 34 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 14, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down Expand Up @@ -2088,7 +2088,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down Expand Up @@ -3220,7 +3220,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 14, 0, 1 ] ] ]);
Expand Down Expand Up @@ -1966,7 +1966,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 14, 0, 1 ] ] ]);
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 13, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 11, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 27, 0, 1 ] ] ]);

Expand Down Expand Up @@ -3483,7 +3483,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 20, 0, 1 ] ] ]);

Expand Down Expand Up @@ -6091,7 +6091,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 20, 0, 1 ] ] ]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 13, 0, 1 ] ] ]);
Expand Down Expand Up @@ -2362,7 +2362,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 13, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 13, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down Expand Up @@ -1945,7 +1945,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down Expand Up @@ -3078,7 +3078,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down Expand Up @@ -4211,7 +4211,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 15, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 12, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 5, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 6, 0, 1 ] ] ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ require(\\"./taro\\");
\\"use strict\\";
__webpack_require__.r(__webpack_exports__);
var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])());
Component(Object(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__[\\"createRecursiveComponentConfig\\"])(\\"custom-wrapper\\"));
}
}, [ [ 15, 0, 1 ] ] ]);
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-mini-runner/src/template/custom-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
import { createRecursiveComponentConfig } from '@tarojs/runtime'
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
Component(createRecursiveComponentConfig())
Component(createRecursiveComponentConfig('custom-wrapper'))
4 changes: 3 additions & 1 deletion packages/taro-runtime/src/dom/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { CurrentReconciler } from '../reconciler'
import { eventCenter } from '../emitter/emitter'
import { incrementId } from '../utils'

const eventIncrementId = incrementId()

export class TaroRootElement extends TaroElement {
private pendingUpdate = false

Expand Down Expand Up @@ -120,7 +122,7 @@ export class TaroRootElement extends TaroElement {
}
const updateArrLen = customWrapperUpdate.length
if (updateArrLen) {
const eventId = `${this._path}_update_${incrementId()}`
const eventId = `${this._path}_update_${eventIncrementId()}`
let executeTime = 0
eventCenter.once(eventId, () => {
executeTime++
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-runtime/src/dsl/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export function createComponentConfig (component: React.ComponentClass, componen
return config
}

export function createRecursiveComponentConfig () {
export function createRecursiveComponentConfig (componentName?: string) {
return {
properties: {
i: {
Expand All @@ -337,7 +337,7 @@ export function createRecursiveComponentConfig () {
},
options: {
addGlobalClass: true,
virtualHost: true
virtualHost: componentName !== 'custom-wrapper'
},
methods: {
eh: eventHandler
Expand Down

0 comments on commit 56378b1

Please sign in to comment.