Skip to content

Commit

Permalink
fix(core): fix defineReactive unnecessary getters call
Browse files Browse the repository at this point in the history
The defineReactive gets the property of the object, only if it has no getter

fix vuejs#7280
  • Loading branch information
DeyLak committed Dec 21, 2017
1 parent 41838c8 commit c39d016
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/observer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class Observer {
walk (obj: Object) {
const keys = Object.keys(obj)
for (let i = 0; i < keys.length; i++) {
defineReactive(obj, keys[i], obj[keys[i]])
defineReactive(obj, keys[i])
}
}

Expand Down Expand Up @@ -145,6 +145,9 @@ export function defineReactive (

// cater for pre-defined getter/setters
const getter = property && property.get
if (!getter && arguments.length <= 2) {
val = obj[key]
}
const setter = property && property.set

let childOb = !shallow && observe(val)
Expand Down

0 comments on commit c39d016

Please sign in to comment.