Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routes with params and reactivity with template level subscriptions #180

Open
squarfed opened this issue Jul 23, 2016 · 0 comments
Open

Comments

@squarfed
Copy link

squarfed commented Jul 23, 2016

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...

@squarfed squarfed reopened this Jul 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant