Skip to content

Commit 9477b91

Browse files
committed
fix(vapor): special handling vapor props in vdom interop
1 parent 1ef6e6e commit 9477b91

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

packages-private/vapor-e2e-test/interop/VaporComp.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const slotProp = ref('slot prop')
2727
change slot prop
2828
</button>
2929
<div class="vdom-slot-in-vapor-default">
30-
#default: <slot :foo="slotProp" />
30+
#default:
31+
<slot :foo="slotProp" />
3132
</div>
3233
<div class="vdom-slot-in-vapor-test">
3334
#test: <slot name="test">fallback content</slot>
@@ -40,7 +41,7 @@ const slotProp = ref('slot prop')
4041
>
4142
Toggle default slot to vdom
4243
</button>
43-
<VdomComp :msg="msg">
44+
<VdomComp :msg="msg" class="foo">
4445
<template #default="{ foo }" v-if="passSlot">
4546
<div>slot prop: {{ foo }}</div>
4647
<div>component prop: {{ msg }}</div>

packages/runtime-core/src/vnode.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,12 @@ export function guardReactiveProps(
666666
props: (Data & VNodeProps) | null,
667667
): (Data & VNodeProps) | null {
668668
if (!props) return null
669-
return isProxy(props) || isInternalObject(props) ? extend({}, props) : props
669+
return isProxy(props) ||
670+
isInternalObject(props) ||
671+
// handling for vapor props
672+
props.__vapor
673+
? extend({}, props)
674+
: props
670675
}
671676

672677
export function cloneVNode<T, U>(

packages/runtime-vapor/src/componentProps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ export function getPropsProxyHandlers(
172172

173173
export function getAttrFromRawProps(rawProps: RawProps, key: string): unknown {
174174
if (key === '$') return
175+
if (key === '__vapor') return true
175176
// need special merging behavior for class & style
176177
const merged = key === 'class' || key === 'style' ? ([] as any[]) : undefined
177178
const dynamicSources = rawProps.$

0 commit comments

Comments
 (0)