From b5209277de6cf0a33afe803bfd5eb2fb600a35fe Mon Sep 17 00:00:00 2001 From: edison Date: Tue, 15 Oct 2019 23:59:40 +0800 Subject: [PATCH] refactor(reactivity): define hadKey if necessary (#288) --- packages/reactivity/src/baseHandlers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/reactivity/src/baseHandlers.ts b/packages/reactivity/src/baseHandlers.ts index 005cb3dd..0043af73 100644 --- a/packages/reactivity/src/baseHandlers.ts +++ b/packages/reactivity/src/baseHandlers.ts @@ -38,12 +38,12 @@ function set( receiver: any ): boolean { value = toRaw(value) - const hadKey = hasOwn(target, key) const oldValue = target[key] if (isRef(oldValue) && !isRef(value)) { oldValue.value = value return true } + const hadKey = hasOwn(target, key) const result = Reflect.set(target, key, value, receiver) // don't trigger if target is something up in the prototype chain of original if (target === toRaw(receiver)) {