mirror of https://github.com/vuejs/core.git
chore: fix vdom slots currentInstance
This commit is contained in:
parent
e8067f1cd9
commit
6c4018652b
|
@ -1,4 +1,4 @@
|
|||
import { type ComponentInternalInstance, getCurrentInstance } from './component'
|
||||
import { type ComponentInternalInstance, currentInstance } from './component'
|
||||
import {
|
||||
type VNode,
|
||||
type VNodeChild,
|
||||
|
@ -94,16 +94,18 @@ const normalizeSlot = (
|
|||
return rawSlot as Slot
|
||||
}
|
||||
const normalized = withCtx((...args: any[]) => {
|
||||
if (__DEV__) {
|
||||
const currentInstance = getCurrentInstance()
|
||||
if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
|
||||
if (
|
||||
__DEV__ &&
|
||||
currentInstance &&
|
||||
!currentInstance.vapor &&
|
||||
(!ctx || ctx.root === (currentInstance as ComponentInternalInstance).root)
|
||||
) {
|
||||
warn(
|
||||
`Slot "${key}" invoked outside of the render function: ` +
|
||||
`this will not track dependencies used in the slot. ` +
|
||||
`Invoke the slot function inside the render function instead.`,
|
||||
)
|
||||
}
|
||||
}
|
||||
return normalizeSlotValue(rawSlot(...args))
|
||||
}, ctx) as Slot
|
||||
// NOT a compiled slot
|
||||
|
|
Loading…
Reference in New Issue