k4r1m
September 24, 2016, 6:55pm
1
Hi,
I have a custom field “customData” in my user document.
I keep getting an exception in my client-console regarding this template helper although the data is showed correctly.
template.x.helpers({
customData: function() {
return Meteor.users.findOne().customData;
}
});
what is causing this “issue”? I appreciate any input.
jamgold
September 24, 2016, 7:49pm
2
Meteor.users is reactive and your helper is probably called more than once. I bet Meteor.users.fondOne() returns null at one of the calls
k4r1m
September 26, 2016, 4:59pm
3
how would you resolve that issue?
jamgold
September 26, 2016, 5:29pm
4
template.x.helpers({
customData: function() {
var user = Meteor.users.findOne();
return user ? user.customData : null;
}
});
1 Like