What I meant by this is that the meals are returned as expected (I get the 4 meals I am supposed to get when using this.props.meals) but that should be the same for my restaurants although I get the default value when using this.props.restaurants.
Publications are identical for both:
if (Meteor.isServer) {
Meteor.publish('meals', function() {
return Meals.find({});
})
}
if (Meteor.isServer) {
Meteor.publish('restaurants', function() {
return Restaurants.find({});
})
}
Tracker methods can run multiple times. They always run once, and they they re-run whenever any reactive dependencies within change. So your defaults will be on the first run, when the subscriptions are most likely not yet ready. When they become ready, it will re-run.
Thank you ! @robfallows ! So then how can I avoid the first loading, which only returns the default value (empty array) ? It causes me lots of headache with other stuff…