File tree 1 file changed +10
-1
lines changed
packages/runtime-vapor/src 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
14
14
ensureRenderer ,
15
15
onScopeDispose ,
16
16
renderSlot ,
17
+ shallowReactive ,
17
18
shallowRef ,
18
19
simpleSetCurrentInstance ,
19
20
} from '@vue/runtime-dom'
@@ -161,7 +162,15 @@ function createVDOMComponent(
161
162
162
163
// overwrite how the vdom instance handles props
163
164
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 )
165
174
instance . attrs = wrapper . attrs
166
175
instance . slots =
167
176
wrapper . slots === EMPTY_OBJ
You can’t perform that action at this time.
0 commit comments