Skip to content

Commit

Permalink
fix(runtime-core): props should be readonly via direct template access
Browse files Browse the repository at this point in the history
close #8216
close #10736
  • Loading branch information
yyx990803 committed Apr 22, 2024
1 parent da7adef commit b93f264
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/runtime-core/src/componentRenderUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -48,7 +49,6 @@ export function renderComponentRoot(
vnode,
proxy,
withProxy,
props,
propsOptions: [propsOptions],
slots,
attrs,
Expand All @@ -60,10 +60,11 @@ export function renderComponentRoot(
ctx,
inheritAttrs,
} = instance
const props = __DEV__ ? shallowReadonly(instance.props) : instance.props
const prev = setCurrentRenderingInstance(instance)

let result
let fallthroughAttrs
const prev = setCurrentRenderingInstance(instance)
if (__DEV__) {
accessedAttrs = false
}
Expand Down

0 comments on commit b93f264

Please sign in to comment.