File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,15 @@ function isEmpty(object) {
12
12
return true ;
13
13
}
14
14
15
- // In Blaze, life-cycle callbacks are not run inside a reactive computation
16
- // but in Vue they are, so we isolate calls when inside a life-cycle callback.
15
+ // In Blaze, life-cycle callbacks are not run inside a reactive computation but in Vue they are, so we isolate calls
16
+ // when inside a life-cycle callback. Otherwise $autorun's computation runs only the first time, but then when the outside
17
+ // reactive computation is invalidated, $autorun's computation stops. And because a life-cycle callback is not called
18
+ // again, $autorun's computation is not recreated. Those life-cycle callbacks are not called from inside current vm's
19
+ // main watcher, but from parent's or even ancestor's higher up. One possible check is to go over all ancestors and check
20
+ // if current computation's watcher is one of ancestor's main watcher. But it seems just checking that the current
21
+ // watcher is some component's main watcher is equivalent, but simpler.
17
22
function isolate ( vm , f ) {
18
- if ( Tracker . currentComputation && Tracker . currentComputation . _pureWatcher && vm . $parent && vm . $parent . _watcher === Tracker . currentComputation . _vueWatcher ) {
23
+ if ( Tracker . currentComputation && Tracker . currentComputation . _pureWatcher && Tracker . currentComputation . _vueWatcher . vm && Tracker . currentComputation . _vueWatcher . vm . _watcher === Tracker . currentComputation . _vueWatcher ) {
19
24
return Tracker . nonreactive ( f ) ;
20
25
}
21
26
return f ( ) ;
You can’t perform that action at this time.
0 commit comments