refactor(reactivity): avoid optional chaining in getDepFromReactive (#12007)

This commit is contained in:
yangxiuxiu 2024-09-24 18:02:01 +08:00 committed by GitHub
parent 7a00f6f093
commit c0e9434414
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 5 deletions

View File

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