[SOLVED] Percolate:Counts Tracker

Hi!

I’m using https://github.com/percolatestudio/publish-counts to get the count of Documents in a publish function.

Is there any way to have Tracker keep count of this count so that I can perform logic in autorun once the count changes?

Thanks!

Nevermind, Counts.get() is a reactive function itself. So no need to use another ReactiveVar or something else.

Just doing,

self.autorun(function () {
    const recordCount = Counts.get('collection');
});

is enough. Having the count get updated then triggers autorun to run.

1 Like