Hello. I have app with structure like this app https://github.com/meteor/todos
Have collection of Leads:
export const Leads = new Mongo.Collection('leads', {
_preventAutopublish: true,
});
Loading templates like this:
FlowRouter.route('/leads', {
name: 'leads',
action() {
BlazeLayout.render('mainLayout', {
content: 'leads'
});
}
});
In Leads template I get leads:
import './leads.html';
import { Leads } from '../../../api/leads/leads.js';
Template.leads.helpers({
leads: function() {
var leads = Leads.find({}, {sort: {createdAt: 1}}).fetch();
if (leads) {
return leads;
}
},
})
When I try fetch leads first time I get empty array and then array of leads. Can somebody tell me why it fire two times and how load leads after manual page refresh. Thanks beforehand.