Skip to content

Commit

Permalink
refactor(reactivity): reduce variable access (#4366)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangenming committed Aug 17, 2021
1 parent c68cba8 commit d8da421
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/reactivity/src/ref.ts
Expand Up @@ -221,9 +221,8 @@ export function toRef<T extends object, K extends keyof T>(
object: T,
key: K
): ToRef<T[K]> {
return isRef(object[key])
? object[key]
: (new ObjectRefImpl(object, key) as any)
const val = object[key]
return isRef(val) ? val : (new ObjectRefImpl(object, key) as any)
}

// corner case when use narrows type
Expand Down

0 comments on commit d8da421

Please sign in to comment.