fix(runtime-core): avoid manual slot invocation in template expressions interfering with block tracking
fix #1745
This commit is contained in:
@@ -35,6 +35,7 @@ import { currentRenderingInstance } from './componentRenderUtils'
|
||||
import { RendererNode, RendererElement } from './renderer'
|
||||
import { NULL_DYNAMIC_COMPONENT } from './helpers/resolveAssets'
|
||||
import { hmrDirtyComponents } from './hmr'
|
||||
import { isRenderingTemplateSlot } from './helpers/renderSlot'
|
||||
|
||||
export const Fragment = (Symbol(__DEV__ ? 'Fragment' : undefined) as any) as {
|
||||
__isFragment: true
|
||||
@@ -400,18 +401,20 @@ function _createVNode(
|
||||
|
||||
normalizeChildren(vnode, children)
|
||||
|
||||
// presence of a patch flag indicates this node needs patching on updates.
|
||||
// component nodes also should always be patched, because even if the
|
||||
// component doesn't need to update, it needs to persist the instance on to
|
||||
// the next vnode so that it can be properly unmounted later.
|
||||
if (
|
||||
shouldTrack > 0 &&
|
||||
(shouldTrack > 0 || isRenderingTemplateSlot) &&
|
||||
// avoid a block node from tracking itself
|
||||
!isBlockNode &&
|
||||
// has current parent block
|
||||
currentBlock &&
|
||||
// presence of a patch flag indicates this node needs patching on updates.
|
||||
// component nodes also should always be patched, because even if the
|
||||
// component doesn't need to update, it needs to persist the instance on to
|
||||
// the next vnode so that it can be properly unmounted later.
|
||||
(patchFlag > 0 || shapeFlag & ShapeFlags.COMPONENT) &&
|
||||
// the EVENTS flag is only for hydration and if it is the only flag, the
|
||||
// vnode should not be considered dynamic due to handler caching.
|
||||
patchFlag !== PatchFlags.HYDRATE_EVENTS &&
|
||||
(patchFlag > 0 || shapeFlag & ShapeFlags.COMPONENT)
|
||||
patchFlag !== PatchFlags.HYDRATE_EVENTS
|
||||
) {
|
||||
currentBlock.push(vnode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user