Skip to content

Commit b93f264

Browse files
committedApr 22, 2024··
fix(runtime-core): props should be readonly via direct template access
close #8216 close #10736
1 parent da7adef commit b93f264

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎packages/runtime-core/src/componentRenderUtils.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
isCompatEnabled,
2727
warnDeprecation,
2828
} from './compat/compatConfig'
29+
import { shallowReadonly } from '@vue/reactivity'
2930

3031
/**
3132
* dev only flag to track whether $attrs was used during render.
@@ -48,7 +49,6 @@ export function renderComponentRoot(
4849
vnode,
4950
proxy,
5051
withProxy,
51-
props,
5252
propsOptions: [propsOptions],
5353
slots,
5454
attrs,
@@ -60,10 +60,11 @@ export function renderComponentRoot(
6060
ctx,
6161
inheritAttrs,
6262
} = instance
63+
const props = __DEV__ ? shallowReadonly(instance.props) : instance.props
64+
const prev = setCurrentRenderingInstance(instance)
6365

6466
let result
6567
let fallthroughAttrs
66-
const prev = setCurrentRenderingInstance(instance)
6768
if (__DEV__) {
6869
accessedAttrs = false
6970
}

0 commit comments

Comments
 (0)
Please sign in to comment.