Reputation: 1709
I receive the following error every time a page renders. I didn't receive these before, they just started one day and the only solution I found until now is to uninstall fast-render. Changing the routes in any way doesn't seem to have any effect. Any idea what the source of the problem could be?
I found the following page which describes a similar error, but I don't have this.redirect(...) or Router.go(...) in a waitOn function: https://github.com/kadirahq/fast-render#3-waiton-and-subscriptions-methods
Here is the code for the Account Route and the corresponding controller:
Router.route("/account", {
name: "Account",
controller: simpleWebsiteController,
waitOn: function () {
return [
Meteor.subscribe("userData"),
Meteor.subscribe("userMessages")
]
},
data: function () {
var messages = Collections.Messages.find({userId: Meteor.userId()},{sort: { creationDate: -1 }});
var posts = Collections.Posts.find({});
var comments = Collections.Comments.find({});
return {
content: "page-account",
userMessages: messages,
userComments: comments,
userPosts: posts
};
},
onBeforeAction: function () {
// If the user is not logged in, redirect to login page
var path = this.location.get().path;
if (!Meteor.userId() && path.indexOf("/login") != 0)
this.location.go("/login");
else
this.next();
}
});
Controller:
var simpleWebsiteController = RouteController.extend({
layoutTemplate: "MainLayout",
waitOn: function () {
return [
Meteor.subscribe("userData"),
Meteor.subscribe("categoriesList"),
Meteor.subscribe("cityData")
]
},
onBeforeAction: function () {
// If the user is not logged in, redirect to login page
var path = this.location.get().path;
if (!Meteor.userId() && path.indexOf("/login") != 0)
this.location.go("/login");
else
this.next();
},
onAfterAction: function() {
$('.row-offcanvas').removeClass('active');
$('.collapse').removeClass('active');
},
fastRender: true
});
Upvotes: 2
Views: 918
Reputation: 1429
Check this answer for more information about the reason of this error.
Unfortunately the fast-render package that flow-router has as a dependency is messing around with meteor internals and would break your code as meteor's core code gets updated.
You can clone and edit kadira's fast-render and fix this problem.
Go to packages folder under your project's directory
cd your_project_dir/packages/
git clone https://github.com/kadirahq/fast-render.git
Then, edit your_project_dir/packages/fast-render/lib/server/context.js like so on line 23:
// support for Meteor.user
// Fibers.current._meteor_dynamics = {};
Fibers.current._meteor_dynamics = []; // <-- Fixed
Now this will overwrite kadira's v2.16.0 fast-render package.
Upvotes: 6
Reputation: 289
this package update was the guilty in my case:
[email protected] -> [email protected]
Edit packages
and/or versions
files and should be ok.
Upvotes: 1