How do I prevent the last template's data from displaying in the next template/route?
I'm having the issue of the last route/template's data rendering in the next until the query is returned. Is this what waitOn is for?
I've tried using waitOn, but this route is supposed to be reactive so I don't want the entire route re-rendering.
Note: this question is different than: meteorjs iron-router waitOn and using as data on rendered because I'm not using a Collection.find({})
query, I'm using a this.subscribe('publication')
type query.
Currently my route is structured like so and this works but it renders other content collection data in it before the subscription is complete:
this.route('news', {
path: '/news',
template: 'contentList',
data: function () {
var content = this.subscribe('content-topics', Session.get('topics'), contentTopicsItemLimit);
var macroTopics = this.subscribe('macro-topics');
var data = {
macroTopics: macroTopics,
content: content
};
return data;
}
});
I've tried using waitOn, but I'm not sure how to structure that with this type of query.
So what is the best way to structure this while maintaining the reactivity?