]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: watcher oldValue
authorEvan You <yyx990803@gmail.com>
Thu, 18 Oct 2018 22:21:14 +0000 (18:21 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 18 Oct 2018 22:21:14 +0000 (18:21 -0400)
packages/core/src/componentWatch.ts

index 33ceb025a0db5f0111621f3a75918bf87ec12a23..183c230b3ad49ee71319ddbc77e0495a2fdbb9b0 100644 (file)
@@ -61,12 +61,12 @@ export function setupWatcher(
   const applyCb = () => {
     const newValue = runner()
     if (options.deep || newValue !== oldValue) {
-      oldValue = newValue
       try {
         cb.call(instance.$proxy, newValue, oldValue)
       } catch (e) {
         handleError(e, instance, ErrorTypes.WATCH_CALLBACK)
       }
+      oldValue = newValue
     }
   }