|
|
@@ -59,11 +59,7 @@ import {
|
|
|
} from '@vue/shared'
|
|
|
import { type RawProps, rawPropsProxyHandlers } from './componentProps'
|
|
|
import type { RawSlots, VaporSlot } from './componentSlots'
|
|
|
-import {
|
|
|
- currentSlotOwner,
|
|
|
- currentSlotScopeIds,
|
|
|
- getParentInstance,
|
|
|
-} from './componentSlots'
|
|
|
+import { currentSlotScopeIds } from './componentSlots'
|
|
|
import { renderEffect } from './renderEffect'
|
|
|
import { _next, createTextNode } from './dom/node'
|
|
|
import { optimizePropertyLookup } from './dom/prop'
|
|
|
@@ -277,10 +273,10 @@ let vdomHydrateNode: HydrationRenderer['hydrateNode'] | undefined
|
|
|
function createVDOMComponent(
|
|
|
internals: RendererInternals,
|
|
|
component: ConcreteComponent,
|
|
|
+ parentComponent: VaporComponentInstance | null,
|
|
|
rawProps?: LooseRawProps | null,
|
|
|
rawSlots?: LooseRawSlots | null,
|
|
|
): VaporFragment {
|
|
|
- const parentInstance = getParentInstance() as VaporComponentInstance | null
|
|
|
const frag = new VaporFragment([])
|
|
|
const vnode = (frag.vnode = createVNode(
|
|
|
component,
|
|
|
@@ -290,9 +286,9 @@ function createVDOMComponent(
|
|
|
{ props: component.props },
|
|
|
rawProps as RawProps,
|
|
|
rawSlots as RawSlots,
|
|
|
- parentInstance ? parentInstance.appContext : undefined,
|
|
|
+ parentComponent ? parentComponent.appContext : undefined,
|
|
|
undefined,
|
|
|
- parentInstance,
|
|
|
+ parentComponent,
|
|
|
)
|
|
|
|
|
|
// overwrite how the vdom instance handles props
|
|
|
@@ -322,9 +318,9 @@ function createVDOMComponent(
|
|
|
if (vnode.shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE) {
|
|
|
vdomDeactivate(
|
|
|
vnode,
|
|
|
- findParentKeepAlive(parentInstance!)!.getStorageContainer(),
|
|
|
+ findParentKeepAlive(parentComponent!)!.getStorageContainer(),
|
|
|
internals,
|
|
|
- parentInstance as any,
|
|
|
+ parentComponent as any,
|
|
|
null,
|
|
|
)
|
|
|
return
|
|
|
@@ -333,14 +329,13 @@ function createVDOMComponent(
|
|
|
}
|
|
|
|
|
|
frag.hydrate = () => {
|
|
|
- hydrateVNode(vnode, parentInstance as any)
|
|
|
+ hydrateVNode(vnode, parentComponent as any)
|
|
|
onScopeDispose(unmount, true)
|
|
|
isMounted = true
|
|
|
frag.nodes = vnode.el as any
|
|
|
}
|
|
|
|
|
|
- const scopeOwner = currentSlotOwner || parentInstance
|
|
|
- vnode.scopeId = (scopeOwner && scopeOwner.type.__scopeId) || null
|
|
|
+ vnode.scopeId = (currentInstance && currentInstance.type.__scopeId) || null
|
|
|
vnode.slotScopeIds = currentSlotScopeIds
|
|
|
|
|
|
frag.insert = (parentNode, anchor, transition) => {
|
|
|
@@ -351,21 +346,21 @@ function createVDOMComponent(
|
|
|
parentNode,
|
|
|
anchor,
|
|
|
internals,
|
|
|
- parentInstance as any,
|
|
|
+ parentComponent as any,
|
|
|
null,
|
|
|
undefined,
|
|
|
false,
|
|
|
)
|
|
|
} else {
|
|
|
const prev = currentInstance
|
|
|
- simpleSetCurrentInstance(parentInstance)
|
|
|
+ simpleSetCurrentInstance(parentComponent)
|
|
|
if (!isMounted) {
|
|
|
if (transition) setVNodeTransitionHooks(vnode, transition)
|
|
|
internals.mt(
|
|
|
vnode,
|
|
|
parentNode,
|
|
|
anchor,
|
|
|
- parentInstance as any,
|
|
|
+ parentComponent as any,
|
|
|
null,
|
|
|
undefined,
|
|
|
false,
|
|
|
@@ -381,7 +376,7 @@ function createVDOMComponent(
|
|
|
parentNode,
|
|
|
anchor,
|
|
|
MoveType.REORDER,
|
|
|
- parentInstance as any,
|
|
|
+ parentComponent as any,
|
|
|
)
|
|
|
}
|
|
|
simpleSetCurrentInstance(prev)
|