Skip to content

Commit cfa325b

Browse files
committed
Support calling Tracker.autorun() inside onMount()
1 parent 1d0403a commit cfa325b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

autorun.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ function _autoStopComputation(computation, component) {
4848
return;
4949
}
5050

51+
if ($$.fragment && $$.dirty[0] === -1) {
52+
// We have a fragment, but it's set to the initial dirty state, so we must
53+
// be in on onMount or so. Don't do anything special, then.
54+
return;
55+
}
56+
5157
// We are in a reactive Svelte update. That means that we'll need to stop the
5258
// computation the next time that it is run. But we don't know when that is,
5359
// because the next update may or may not hit this autorun again, depending on

0 commit comments

Comments
 (0)