diff --git a/packages/runtime-core/src/componentRenderUtils.ts b/packages/runtime-core/src/componentRenderUtils.ts index 4b83c699031..6772474bdef 100644 --- a/packages/runtime-core/src/componentRenderUtils.ts +++ b/packages/runtime-core/src/componentRenderUtils.ts @@ -26,6 +26,7 @@ import { isCompatEnabled, warnDeprecation, } from './compat/compatConfig' +import { shallowReadonly } from '@vue/reactivity' /** * dev only flag to track whether $attrs was used during render. @@ -93,7 +94,7 @@ export function renderComponentRoot( thisProxy, proxyToUse!, renderCache, - props, + __DEV__ ? shallowReadonly(props) : props, setupState, data, ctx, @@ -110,19 +111,22 @@ export function renderComponentRoot( result = normalizeVNode( render.length > 1 ? render( - props, + __DEV__ ? shallowReadonly(props) : props, __DEV__ ? { get attrs() { markAttrsAccessed() - return attrs + return shallowReadonly(attrs) }, slots, emit, } : { attrs, slots, emit }, ) - : render(props, null as any /* we know it doesn't need it */), + : render( + __DEV__ ? shallowReadonly(props) : props, + null as any /* we know it doesn't need it */, + ), ) fallthroughAttrs = Component.props ? attrs