komentify / meteor-comments-ui

Simple templates for comment functionality in your Meteor App
MIT License
76 stars 40 forks source link

Problem when rendering with flow router on route change. #93

Closed delay closed 8 years ago

delay commented 8 years ago

When using flow router I was having a problem when changing routes to a new page with different comments it was giving me some js errors in comment-ui and not rendering the new comments. I tracked it down to flow router not completely re-rendering the comments templates when a new id was passed in. To solve this problem you need to do a BlazeLayout.reset() each time the route changes. This took me a while to track down and figure out the solution. So I figured I would post it here in case someone else was having this trouble as well.

FlowRouter.route('/comments/:_id', {
    action: function (params, queryParams) {
        BlazeLayout.reset();
        BlazeLayout.render('defaultLayout', {content: 'comments'})
    }
});
matteodem commented 8 years ago

Can you provide a reproduction repository for the problem?