]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): only set cache for object keys (#6266)
authorDaniel Roe <daniel@roe.dev>
Mon, 29 Aug 2022 03:10:16 +0000 (04:10 +0100)
committerGitHub <noreply@github.com>
Mon, 29 Aug 2022 03:10:16 +0000 (23:10 -0400)
packages/runtime-core/src/componentEmits.ts
packages/runtime-core/src/componentOptions.ts
packages/runtime-core/src/componentProps.ts

index 68393c80b351e2b31d879bdb9ef329f1a782f773..b113eaa53573489ea75873d0d7d0d16b2d896ca5 100644 (file)
@@ -7,6 +7,7 @@ import {
   hyphenate,
   isArray,
   isFunction,
+  isObject,
   isOn,
   toNumber,
   UnionToIntersection
@@ -226,7 +227,9 @@ export function normalizeEmitsOptions(
   }
 
   if (!raw && !hasExtends) {
-    cache.set(comp, null)
+    if (isObject(comp)) {
+      cache.set(comp, null)
+    }
     return null
   }
 
@@ -236,7 +239,9 @@ export function normalizeEmitsOptions(
     extend(normalized, raw)
   }
 
-  cache.set(comp, normalized)
+  if (isObject(comp)) {
+    cache.set(comp, normalized)
+  }
   return normalized
 }
 
index 0d47e18c4af50c46058bb8377990db71e0205685..36ba0d5166a14a78181fb8bac3584b09371ce9f7 100644 (file)
@@ -966,8 +966,9 @@ export function resolveMergedOptions(
     }
     mergeOptions(resolved, base, optionMergeStrategies)
   }
-
-  cache.set(base, resolved)
+  if (isObject(base)) {
+    cache.set(base, resolved)
+  }
   return resolved
 }
 
index e046342db3566214efb928593ce56873fc399205..51b77c56175fca5b085081dc09cefb4f4d6c1ce0 100644 (file)
@@ -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
   }
 
@@ -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
 }