-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(runtime-core): handle nested reactive object in guardReactiveProps #11693
base: main
Are you sure you want to change the base?
Conversation
Size ReportBundles
Usages
|
commit: @vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
|
setup() { | ||
const { obj } = toRefs(state) | ||
setTimeout(async () => { | ||
state.obj.style.color = 'yellow' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not move those 3 lines to the end of this case?
packages/runtime-core/src/vnode.ts
Outdated
function generateProps(props: Data & VNodeProps) { | ||
const target: Data & VNodeProps = {} | ||
for (const key in props) { | ||
if (isProxy(props[key])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should check props[key]
is Object first.
consider the following situation:
const state = reactive({
title: 'hi',
obj: {
style: {
color: 'red',
},
},
})
In theory, only 2 layers of nesting need to be handled here, and for safety, maybe it is necessary to deal with deep recursive processing.
close #11691
this pr playground