Subscriptions have moved from being top level to router level and from router level to template/component level.
I’ve been thinking about taking it a step further and doing helper level subscriptions. Specifically, I’d like to subscribe in my collection helpers that connect me to related data. But if this is a solid idea, it could also be used for template helpers.
But is there something wrong with this approach? I just keep thinking that if it was a good idea, I’d have seen other people using it but I’m not. So is there some bad reason that I’m not thinking of?
const Authors = new Mongo.Collection('authors');
const Posts = new Mongo.Collection('posts');
Posts.helpers({
author() {
Meteor.subscribe('author', this.authorId);
return Authors.findOne(this.authorId);
},
});