Skip to content

Commit

Permalink
fix(runtime-core): only set cache for object keys (vuejs#6266)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Aug 29, 2022
1 parent 2024d11 commit c3465c1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
9 changes: 7 additions & 2 deletions packages/runtime-core/src/componentEmits.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit c3465c1

Please sign in to comment.