Why do template helpers and other pieces of code run multiple times?

Ok. So I understand meteor is reactive and if a reactive variable is changed it can cause a computation to be invalidated and the code to be rerun, but I often find myself running into a situation where code is rerun multiple times after a single change. I can’t imagine this only happens to me. Why does this happen? Or how do I go about stopping it from happening?

I don’t have a simple example of when this happens (and I’m guessing if I did, I’d be able to solve the problem myself). Does anyone have any tips to avoid this from happening?

A lot of the time it really doesn’t matter to me, but it just seems like a bit of a waste (and perhaps marginally slows down the app).

That generally happens with subscriptions and also with 3rd party reactive components (router, forms, validations etc) but there is no blanket reason that one can point fingers at.

If you cannot produce a simple example that demonstrates the case, than by logic, we cannot provide a simple answer :smile:

Next time you come across a case like this, share some code and we’ll do our best to guide you through it and pinpoint where/how/why computations are being rerun.