Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/runtime-core/__tests__/componentProps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ describe('component props', () => {
render(h(Comp, { foo: 1 }), root)
expect(props).toEqual({ foo: 1 })
expect(attrs).toEqual({ foo: 1 })
expect(props).toBe(attrs)
expect(props).toStrictEqual(attrs)

render(h(Comp, { bar: 2 }), root)
expect(props).toEqual({ bar: 2 })
expect(attrs).toEqual({ bar: 2 })
expect(props).toBe(attrs)
expect(props).toStrictEqual(attrs)
})

test('boolean casting', () => {
Expand Down
10 changes: 7 additions & 3 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 Down Expand Up @@ -78,7 +79,7 @@ export function renderComponentRoot(
proxyToUse,
proxyToUse!,
renderCache,
props,
__DEV__ ? shallowReadonly(props) : props,
setupState,
data,
ctx
Expand All @@ -95,7 +96,7 @@ export function renderComponentRoot(
result = normalizeVNode(
render.length > 1
? render(
props,
__DEV__ ? shallowReadonly(props) : props,
__DEV__
? {
get attrs() {
Expand All @@ -107,7 +108,10 @@ export function renderComponentRoot(
}
: { 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
Expand Down