How avoid helper running each time Meteor.user() changes

42 views Asked by At

I have the following helper in Meteor:

fullname(){
  return Meteor.user().currentName;
},

But this helper runs every time Meteor.user() changes. I only want it to run when currentName of the user changes, not for example just firstName.

1

There are 1 answers

0
Michel Floyd On

Use .findOne() and restrict the keys that are returned:

fullname(){
  return Meteor.users.findOne(Meteor.userId(),{fields: {currentName: 1}}).currentName;
},