Skip to content

Commit

Permalink
fix(runtime-core): only set cache for object keys
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jul 13, 2022
1 parent 8dcb6c7 commit d956a0d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
8 changes: 6 additions & 2 deletions packages/runtime-core/src/componentEmits.ts
Expand Up @@ -226,7 +226,9 @@ export function normalizeEmitsOptions(
}

if (!raw && !hasExtends) {
cache.set(comp, null)
if (comp && typeof comp === 'object') {
cache.set(comp, null)
}
return null
}

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

cache.set(comp, normalized)
if (comp && typeof comp === 'object') {
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 (base && typeof base === 'object') {
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 (comp && typeof comp === 'object') {
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 (comp && typeof comp === 'object') {
cache.set(comp, res)
}
return res
}

Expand Down

0 comments on commit d956a0d

Please sign in to comment.