From fc1d6e52f37b222666da49531c89672525f2bd6f Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 19 Sep 2018 23:56:40 -0400 Subject: [PATCH] fix: beforeUpdate should not be called via onTrigger --- packages/core/src/createRenderer.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/core/src/createRenderer.ts b/packages/core/src/createRenderer.ts index 0541d1fb..6ab6ab42 100644 --- a/packages/core/src/createRenderer.ts +++ b/packages/core/src/createRenderer.ts @@ -1206,9 +1206,8 @@ export function createRenderer(options: RendererOptions) { } }, { - scheduler: queueUpdate, - onTrigger: - instance.beforeUpdate && instance.beforeUpdate.bind(instance.$proxy) + scheduler: queueUpdate + // TODO add API for using onTrigger for component re-render debugging } ) @@ -1237,9 +1236,12 @@ export function createRenderer(options: RendererOptions) { container: RenderNode | null, isSVG: boolean ) { - // beforeUpdate is called as the onTrack hook of the instance's reactive - // runner const prevVNode = instance.$vnode + + if (instance.beforeUpdate) { + instance.beforeUpdate.call(instance.$proxy, prevVNode) + } + const nextVNode = (instance.$vnode = renderInstanceRoot(instance)) container = container || parentNode(prevVNode.el as RenderNode | RenderFragment)