Skip to content
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): only set cache for object keys #6266

Merged
merged 2 commits into from Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/runtime-core/src/componentEmits.ts
Expand Up @@ -7,6 +7,7 @@ import {
hyphenate,
isArray,
isFunction,
isObject,
isOn,
toNumber,
UnionToIntersection
Expand Down Expand Up @@ -226,7 +227,9 @@ export function normalizeEmitsOptions(
}

if (!raw && !hasExtends) {
cache.set(comp, null)
if (isObject(comp)) {
cache.set(comp, null)
}
return null
}

Expand All @@ -236,7 +239,9 @@ export function normalizeEmitsOptions(
extend(normalized, raw)
}

cache.set(comp, normalized)
if (isObject(comp)) {
cache.set(comp, normalized)
}
return normalized
}

Expand Down
5 changes: 3 additions & 2 deletions packages/runtime-core/src/componentOptions.ts
Expand Up @@ -966,8 +966,9 @@ export function resolveMergedOptions(
}
mergeOptions(resolved, base, optionMergeStrategies)
}

cache.set(base, resolved)
if (isObject(base)) {
cache.set(base, resolved)
}
return resolved
}

Expand Down
8 changes: 6 additions & 2 deletions packages/runtime-core/src/componentProps.ts
Expand Up @@ -494,7 +494,9 @@ export function normalizePropsOptions(
}

if (!raw && !hasExtends) {
cache.set(comp, EMPTY_ARR as any)
if (isObject(comp)) {
cache.set(comp, EMPTY_ARR as any)
}
return EMPTY_ARR as any
}

Expand Down Expand Up @@ -534,7 +536,9 @@ export function normalizePropsOptions(
}

const res: NormalizedPropsOptions = [normalized, needCastKeys]
cache.set(comp, res)
if (isObject(comp)) {
cache.set(comp, res)
}
return res
}

Expand Down