fix(reactivity): avoid triggering effect when deleting property returns false (#168)

This commit is contained in:
terencez 2019-10-09 23:55:57 +08:00 committed by Evan You
parent b9a4d8d088
commit ff68db46ea

View File

@ -70,7 +70,7 @@ function deleteProperty(target: any, key: string | symbol): boolean {
const hadKey = hasOwn(target, key)
const oldValue = target[key]
const result = Reflect.deleteProperty(target, key)
if (hadKey) {
if (result && hadKey) {
/* istanbul ignore else */
if (__DEV__) {
trigger(target, OperationTypes.DELETE, key, { oldValue })