perf: avoid deopt for props/emits normalization when global mixins are used
This commit is contained in:
@@ -436,8 +436,10 @@ export function normalizePropsOptions(
|
||||
appContext: AppContext,
|
||||
asMixin = false
|
||||
): NormalizedPropsOptions {
|
||||
if (!appContext.deopt && comp.__props) {
|
||||
return comp.__props
|
||||
const cache = appContext.propsCache
|
||||
const cached = cache.get(comp)
|
||||
if (cached) {
|
||||
return cached
|
||||
}
|
||||
|
||||
const raw = comp.props
|
||||
@@ -468,7 +470,8 @@ export function normalizePropsOptions(
|
||||
}
|
||||
|
||||
if (!raw && !hasExtends) {
|
||||
return (comp.__props = EMPTY_ARR as any)
|
||||
cache.set(comp, EMPTY_ARR as any)
|
||||
return EMPTY_ARR as any
|
||||
}
|
||||
|
||||
if (isArray(raw)) {
|
||||
@@ -506,7 +509,9 @@ export function normalizePropsOptions(
|
||||
}
|
||||
}
|
||||
|
||||
return (comp.__props = [normalized, needCastKeys])
|
||||
const res: NormalizedPropsOptions = [normalized, needCastKeys]
|
||||
cache.set(comp, res)
|
||||
return res
|
||||
}
|
||||
|
||||
function validatePropName(key: string) {
|
||||
|
||||
Reference in New Issue
Block a user