Skip to content

Commit 7503c2e

Browse files
committed
Fixed an edge case in Tracker.nonreactive.
1 parent f054458 commit 7503c2e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/core/observer/dep.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Dep.target = null
4949
const targetStack = []
5050

5151
export function pushTarget (_target: Watcher) {
52-
if (Dep.target) targetStack.push(Dep.target)
52+
targetStack.push(Dep.target)
5353
Dep.target = _target
5454
}
5555

src/core/observer/watcher.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default class Watcher {
9191
/**
9292
* Evaluate the getter, and re-collect dependencies.
9393
*/
94-
get () {
94+
get (dontCleanupDeps: ?boolean) {
9595
pushTarget(this)
9696
let value
9797
const vm = this.vm
@@ -110,7 +110,9 @@ export default class Watcher {
110110
traverse(value)
111111
}
112112
popTarget()
113-
this.cleanupDeps()
113+
if (!dontCleanupDeps) {
114+
this.cleanupDeps()
115+
}
114116
}
115117
return value
116118
}

0 commit comments

Comments
 (0)