Getting a strange error in Meteor:
Route dispatch never rendered. Did you forget to call this.next() in an onBeforeAction?
and none of the content is rendering. How can I fix this? Any help greatly appreciated.
Here's my router.js
Router.configure({
layoutTemplate: 'layout',
});
Router.route('/', function() {
this.render('home');
});
Router.route('/user/:_username', {
name: 'user_profile',
data: function() { return Meteor.user();}
});
Router.route('/create', function() {
this.render('create_event');
});
Router.route('/events/:name', {
name: 'event',
data: function() { return Events.findOne({name: this.params.name});}
});
Router.route('/useremail', function() {
this.render('userEmail');
}, {
name: 'userEmail'
});
Router._filters = {
hasCompletedProfile: function() {
if(!this.ready()) return;
var user = Meteor.user();
if (user && ! userProfileComplete(user)){
this.render('userEmail');
} else {
this.next();
}
},
};
filters = Router._filters;
Router.onBeforeAction(filters.hasCompletedProfile);
Make sure you always call
this.next();
in yourRouter._filters
method and not just on a condition.Try replace your
Router._filters
method with this: