Skip to content

Commit a770a83

Browse files
committed
wip(vapor): support vapor component as root in vdom app
1 parent ccd42b1 commit a770a83

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/runtime-core/src/renderer.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -1160,14 +1160,14 @@ function baseCreateRenderer(
11601160

11611161
if ((n2.type as ConcreteComponent).__vapor) {
11621162
if (n1 == null) {
1163-
getVaporInterface(parentComponent).mount(
1163+
getVaporInterface(parentComponent, n2).mount(
11641164
n2,
11651165
container,
11661166
anchor,
11671167
parentComponent,
11681168
)
11691169
} else {
1170-
getVaporInterface(parentComponent).update(
1170+
getVaporInterface(parentComponent, n2).update(
11711171
n1,
11721172
n2,
11731173
shouldUpdateComponent(n1, n2, optimized),
@@ -2055,7 +2055,7 @@ function baseCreateRenderer(
20552055
const { el, type, transition, children, shapeFlag } = vnode
20562056
if (shapeFlag & ShapeFlags.COMPONENT) {
20572057
if ((type as ConcreteComponent).__vapor) {
2058-
getVaporInterface(parentComponent).move(vnode, container, anchor)
2058+
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor)
20592059
} else {
20602060
move(
20612061
vnode.component!.subTree,
@@ -2185,7 +2185,7 @@ function baseCreateRenderer(
21852185

21862186
if (shapeFlag & ShapeFlags.COMPONENT) {
21872187
if ((type as ConcreteComponent).__vapor) {
2188-
getVaporInterface(parentComponent).unmount(vnode, doRemove)
2188+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove)
21892189
} else {
21902190
unmountComponent(vnode.component!, parentSuspense, doRemove)
21912191
}
@@ -2620,8 +2620,10 @@ export function invalidateMount(hooks: LifecycleHook | undefined): void {
26202620

26212621
function getVaporInterface(
26222622
instance: ComponentInternalInstance | null,
2623+
vnode: VNode,
26232624
): VaporInteropInterface {
2624-
const res = instance!.appContext.vapor
2625+
const ctx = instance ? instance.appContext : vnode.appContext
2626+
const res = ctx && ctx.vapor
26252627
if (__DEV__ && !res) {
26262628
warn(
26272629
`Vapor component found in vdom tree but vapor-in-vdom interop was not installed. ` +

0 commit comments

Comments
 (0)