Hi,
I have a table that am constructing from various calculations for each user; being done inside a server method. The template understandably renders way before the method’s response every single user is back; and even then - I wouldn’t want to hold it back.
in the template - which can have many users to iterate through is part of an {{#each}} directive
..
{{ userEventCount this._id 'assigned' }}
..
My userEventCount helper definition:
userEventCount: function (userId, status) {
userId ? check(userId, String) : null;
status ? check(status, String) : null;
Meteor.call('getUserEvents', userId, status, FlowRouter.getParam('calendarId'), function (err, res) {
if (!err) {
Session.set('hh_getUserEvents_' + userId, res.length);
}
});
return Session.get('hh_getUserEvents_' + userId);
}
Ideally - I’d like to not pollute the session space for “working out" - after all - each user is unique - hence the appending of the _id
.
Does anyone has a better way of doing this? Is there a pattern for this type of problem that I could follow ?
Am certain this comes up quite often. Searching didn’t yield anything immediately useful. Insight appreciated.
Thank you.