Skip to content

Commit bd701f2

Browse files
committed
fix(vapor): ensure props are shallow reactive to prevent DEV warnings
1 parent 1ef6e6e commit bd701f2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/runtime-vapor/src/vdomInterop.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
ensureRenderer,
1515
onScopeDispose,
1616
renderSlot,
17+
shallowReactive,
1718
shallowRef,
1819
simpleSetCurrentInstance,
1920
} from '@vue/runtime-dom'
@@ -161,7 +162,15 @@ function createVDOMComponent(
161162

162163
// overwrite how the vdom instance handles props
163164
vnode.vi = (instance: ComponentInternalInstance) => {
164-
instance.props = wrapper.props
165+
// Ensure props are shallow reactive to align with VDOM behavior.
166+
// This enables direct watching of props and prevents DEV warnings.
167+
//
168+
// Example:
169+
// const props = defineProps(...)
170+
// watch(props, () => { ... }) // props must be reactive for this to work
171+
//
172+
// Without reactivity, Vue will warn in DEV about non-reactive watch sources
173+
instance.props = shallowReactive(wrapper.props)
165174
instance.attrs = wrapper.attrs
166175
instance.slots =
167176
wrapper.slots === EMPTY_OBJ

0 commit comments

Comments
 (0)