From: yangxiuxiu <79584569+yangxiuxiu1115@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:02:01 +0000 (+0800) Subject: refactor(reactivity): avoid optional chaining in getDepFromReactive (#12007) X-Git-Tag: v3.5.9~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0e9434414f28d912126bcb5325647925c4d49b8;p=thirdparty%2Fvuejs%2Fcore.git refactor(reactivity): avoid optional chaining in getDepFromReactive (#12007) --- diff --git a/packages/reactivity/src/dep.ts b/packages/reactivity/src/dep.ts index 61f0a59c35..0a795be4f4 100644 --- a/packages/reactivity/src/dep.ts +++ b/packages/reactivity/src/dep.ts @@ -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) }