提交 4f490366 编写于 作者: fxy060608's avatar fxy060608

fix(mp): pre flush watchers (#3057)

上级 0ced70cc
......@@ -4778,6 +4778,13 @@ function renderComponentRoot(instance) {
setCurrentRenderingInstance(prev);
return result;
}
const updateComponentPreRender = (instance) => {
pauseTracking();
// props update may have triggered pre-flush watchers.
// flush them before the render update.
flushPreFlushCbs(undefined, instance.update);
resetTracking();
};
function setupRenderEffect(instance) {
const componentUpdateFn = () => {
if (!instance.isMounted) {
......@@ -4787,6 +4794,7 @@ function setupRenderEffect(instance) {
// updateComponent
const { bu, u } = instance;
effect.allowRecurse = false;
updateComponentPreRender(instance);
// beforeUpdate hook
if (bu) {
invokeArrayFns(bu);
......
......@@ -4778,6 +4778,13 @@ function renderComponentRoot(instance) {
setCurrentRenderingInstance(prev);
return result;
}
const updateComponentPreRender = (instance) => {
pauseTracking();
// props update may have triggered pre-flush watchers.
// flush them before the render update.
flushPreFlushCbs(undefined, instance.update);
resetTracking();
};
function setupRenderEffect(instance) {
const componentUpdateFn = () => {
if (!instance.isMounted) {
......@@ -4787,6 +4794,7 @@ function setupRenderEffect(instance) {
// updateComponent
const { bu, u } = instance;
effect.allowRecurse = false;
updateComponentPreRender(instance);
// beforeUpdate hook
if (bu) {
invokeArrayFns(bu);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册