]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor(reactivity): avoid optional chaining in getDepFromReactive (#12007)
authoryangxiuxiu <79584569+yangxiuxiu1115@users.noreply.github.com>
Tue, 24 Sep 2024 10:02:01 +0000 (18:02 +0800)
committerGitHub <noreply@github.com>
Tue, 24 Sep 2024 10:02:01 +0000 (18:02 +0800)
packages/reactivity/src/dep.ts

index 61f0a59c352a3f655fd1dca2b4e41a3c19af6497..0a795be4f49720a089d481cc60f1da0270f40761 100644 (file)
@@ -378,13 +378,10 @@ export function trigger(
   endBatch()
 }
 
-/**
- * Test only
- */
 export function getDepFromReactive(
   object: any,
   key: string | number | symbol,
 ): Dep | undefined {
-  // eslint-disable-next-line
-  return targetMap.get(object)?.get(key)
+  const depMap = targetMap.get(object)
+  return depMap && depMap.get(key)
 }