How to check what caused Tracker.autorun fire in Meteor?

346 views Asked by At

During loading my Meteor app my Tracker.autorun function fires too many times. I'd like to inspect what causes that problem, but I cannot even check inside the function what event caused its actual fire. How can I do this?

edit:

If I do console.trace() in my autorun I get this:

(anonymous) @ VM6091:1
(anonymous) @ createStore.js:21
Tracker.Computation._compute @ tracker.js:311
Tracker.Computation @ tracker.js:201
Tracker.autorun @ tracker.js:576
module.export.exports.default @ createStore.js:15
(anonymous) @ main.js:36
maybeReady @ startup_client.js:26
loadingCompleted @ startup_client.js:38

But I still cannot tell what caused loadingCompleted function to fire.

1

There are 1 answers

3
Shynggys Kengessov On BEST ANSWER

During loading my Meteor app my Tracker.autorun function fires too many times.

This means you are changing reactive source that's used inside your autorun function too many times.

1) You can catch changes using browser breakpoints. Just create breakpoint inside your autorun function, and look at call stack.

2) You can log all of functions that changes your reactive sources (Collection, ReactiveVar, etc...)