fix: beforeUpdate should not be called via onTrigger

This commit is contained in:
Evan You 2018-09-19 23:56:40 -04:00
parent 232d14c0dd
commit fc1d6e52f3

View File

@ -1206,9 +1206,8 @@ export function createRenderer(options: RendererOptions) {
} }
}, },
{ {
scheduler: queueUpdate, scheduler: queueUpdate
onTrigger: // TODO add API for using onTrigger for component re-render debugging
instance.beforeUpdate && instance.beforeUpdate.bind(instance.$proxy)
} }
) )
@ -1237,9 +1236,12 @@ export function createRenderer(options: RendererOptions) {
container: RenderNode | null, container: RenderNode | null,
isSVG: boolean isSVG: boolean
) { ) {
// beforeUpdate is called as the onTrack hook of the instance's reactive
// runner
const prevVNode = instance.$vnode const prevVNode = instance.$vnode
if (instance.beforeUpdate) {
instance.beforeUpdate.call(instance.$proxy, prevVNode)
}
const nextVNode = (instance.$vnode = renderInstanceRoot(instance)) const nextVNode = (instance.$vnode = renderInstanceRoot(instance))
container = container =
container || parentNode(prevVNode.el as RenderNode | RenderFragment) container || parentNode(prevVNode.el as RenderNode | RenderFragment)