[Non reactive]Meteor.call vs find({},{reactive:false})

I’ve been reading over the remotebase.io blog post about migrating from Meteor and one of the issues expressed was too much reactivity in the app. I believe we currently have the same issue that some parts of our app use reactivity when they don’t have to. I wonder what’s the difference between doing a Meteor.call and doing a find query with reactive:false set?

Which one is the preferred or recommended way to do it?

2 Likes

Using find with reactive:false affects the client in that it doesn’t register the cursor with Tracker. On the server, the corresponding publish still sets up an observer which “sees” updates to the collection and publishes them. This is so that a subsequent client find will retrieve those pending updates.

On the other hand, within a method your query is fire and forget (no observers), which is much more efficient - unless, of course, you need reactivity!

My rule-of-thumb is to only use pub/sub for those few things which absolutely must have sub-second reactivity. In practice, those use cases (for me) are few and far between.

3 Likes