fix(runtime-core): should not track dynamic children when the user calls a compiled slot inside template expression (#3554)
fix #3548, partial fix for #3569
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Data } from '../component'
|
||||
import { Slots, RawSlots } from '../componentSlots'
|
||||
import { ContextualRenderFn } from '../componentRenderContext'
|
||||
import { Comment, isVNode } from '../vnode'
|
||||
import {
|
||||
VNodeArrayChildren,
|
||||
@@ -11,10 +12,6 @@ import {
|
||||
import { PatchFlags, SlotFlags } from '@vue/shared'
|
||||
import { warn } from '../warning'
|
||||
|
||||
export let isRenderingCompiledSlot = 0
|
||||
export const setCompiledSlotRendering = (n: number) =>
|
||||
(isRenderingCompiledSlot += n)
|
||||
|
||||
/**
|
||||
* Compiler runtime helper for rendering `<slot/>`
|
||||
* @private
|
||||
@@ -43,7 +40,9 @@ export function renderSlot(
|
||||
// invocation interfering with template-based block tracking, but in
|
||||
// `renderSlot` we can be sure that it's template-based so we can force
|
||||
// enable it.
|
||||
isRenderingCompiledSlot++
|
||||
if (slot && (slot as ContextualRenderFn)._c) {
|
||||
;(slot as ContextualRenderFn)._d = false
|
||||
}
|
||||
openBlock()
|
||||
const validSlotContent = slot && ensureValidVNode(slot(props))
|
||||
const rendered = createBlock(
|
||||
@@ -57,7 +56,9 @@ export function renderSlot(
|
||||
if (!noSlotted && rendered.scopeId) {
|
||||
rendered.slotScopeIds = [rendered.scopeId + '-s']
|
||||
}
|
||||
isRenderingCompiledSlot--
|
||||
if (slot && (slot as ContextualRenderFn)._c) {
|
||||
;(slot as ContextualRenderFn)._d = true
|
||||
}
|
||||
return rendered
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user