fix(runtime-core): only set cache for object keys (#6266)

This commit is contained in:
Daniel Roe 2022-08-29 04:10:16 +01:00 committed by GitHub
parent 2024d11db0
commit c3465c1e88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import {
hyphenate, hyphenate,
isArray, isArray,
isFunction, isFunction,
isObject,
isOn, isOn,
toNumber, toNumber,
UnionToIntersection UnionToIntersection
@ -226,7 +227,9 @@ export function normalizeEmitsOptions(
} }
if (!raw && !hasExtends) { if (!raw && !hasExtends) {
if (isObject(comp)) {
cache.set(comp, null) cache.set(comp, null)
}
return null return null
} }
@ -236,7 +239,9 @@ export function normalizeEmitsOptions(
extend(normalized, raw) extend(normalized, raw)
} }
if (isObject(comp)) {
cache.set(comp, normalized) cache.set(comp, normalized)
}
return normalized return normalized
} }

View File

@ -966,8 +966,9 @@ export function resolveMergedOptions(
} }
mergeOptions(resolved, base, optionMergeStrategies) mergeOptions(resolved, base, optionMergeStrategies)
} }
if (isObject(base)) {
cache.set(base, resolved) cache.set(base, resolved)
}
return resolved return resolved
} }

View File

@ -494,7 +494,9 @@ export function normalizePropsOptions(
} }
if (!raw && !hasExtends) { if (!raw && !hasExtends) {
if (isObject(comp)) {
cache.set(comp, EMPTY_ARR as any) cache.set(comp, EMPTY_ARR as any)
}
return EMPTY_ARR as any return EMPTY_ARR as any
} }
@ -534,7 +536,9 @@ export function normalizePropsOptions(
} }
const res: NormalizedPropsOptions = [normalized, needCastKeys] const res: NormalizedPropsOptions = [normalized, needCastKeys]
if (isObject(comp)) {
cache.set(comp, res) cache.set(comp, res)
}
return res return res
} }