Helper reactivity from imported functions

Is a template helper reactive if it does not itself contain a reactive variable like Session.get(), but it contains a function imported from another .js file that uses Session.get()?

Hi - yes, that’s the cool stuff with the tracker, you can call basically nested code querying the database etc. and it’ll all be reactive.

The only issue is: This works currently with the Meteor 2.x versions & the non-async database calls.

Async calls break this reactivity, basically, if you don’t wrap reactive getters with Tracker.wrapAsync() which can get messy…

So for Meteor 3.0 or code which is preparing for the migration to 3. and uses Blaze & reactivity the issue is a bit more complex and we’re currently working on finding a good solution.

One approach is to cache all data received from async calls in reactive variables in the template so you don’t have to call async functions from your helper but you update this reactive vars from your async queries basically.

Another approach we’re using for our app is using a babel plugin to restore this functionality, mostly: 🍕 Blaze / Async Migration Helper: Babel Plugin Tracker-Async-Enhance for the Client Side released

Sorry that this answer has become a bit more complex than it should for a simple question, but it’s not that easy to answer at the current time when the ecosystem is migrating to Meteor 3.0 with async/await.

TL;DR:

For Meteor 2.x using Sync functions: Yes. This is how it was meant to be used from Blaze’s inception
For 3.0 / Async Meteor: Unfortunately not automatically anymore, but you can make it work.

thanks for the detailed answer. still in 2.13 and it had been working just as you described.