Routes with params and reactivity with template level subscriptions
Opened this issue · 0 comments
squarfed commented
How should one use fast render when the route has parameters? I have this code in the lib
folder:
FlowRouter.route('/articles/:articleId', {
action: function() {
// The template 'article' runs the following subscription:
// this.subscribe('singleArticle',articleId)
BlazeLayout.render('website', {content: 'article'});
}
});
if (Meteor.isServer) {
FastRender.route('/articles/:articleId', function(params) {
console.log('params: ',params)
this.subscribe('singleArticle', params.articleId)
})
}
However the FastRender.route
code does not run again when you go to a route with a different article_id. I tried using:
Tracker.autorun( () => {
FlowRouter.watchPathChange()
console.log('params: ',params)
this.subscribe('singleArticle', params.articleId)
})
But watchPathChange
is not defined on the server...