-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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): use camelized prop key to check if it is absent #12034
Conversation
I can't modify the regex |
Size ReportBundles
Usages
|
@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/compat
vue
commit: |
@@ -662,7 +663,7 @@ function validateProps( | |||
resolvedValues[key], | |||
opt, | |||
__DEV__ ? shallowReadonly(resolvedValues) : resolvedValues, | |||
!hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)), | |||
!hasOwn(rawProps, key) && !camelizePropsKey.includes(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.
!hasOwn(rawProps, key) && !camelizePropsKey.includes(key), | |
!camelizePropsKey.includes(key), |
!hasOwn(rawProps, key)
seems no longer needed due to the prop key is always camelized.
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.
You're right, I'm writing this because I'm not sure if the performance of includes
will be worse than hasOwn
, so I only do the following operations when hasOwn (rawProps, key)
is not met
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.
So do you think I should remove the previous judgment
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.
I think it is fine because this check only happens in DEV.
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.
ok. I'll fix it
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.
@edison1105 done
fix #12011