Wait for Meteor.user () to fully load before the model is rendered

advertisements

This has been asked before however, I don't feel I've seen a suitable answer. I'm currently using {{ #if currentUser.emails.[0].verified }} show data {{else}} please verify email {{/if}} on the layout template check whether or not the user has verified their email. In this scenario, I get a flicker between the screens if the user has registered because meteor.user() hasn't loaded completely so currentUser.emails.[0].verified returns null and changes to true once it has loaded completely.

Is there a way I can wait for Meteor.userId to completely load before the template renders without using delay?


The meteor embedded "currentUser" helper can let you know when the user collection is ready:

{{#if currentUser}} // Do my stuff {{else}} Checking... // You can also show a spinner image or GIF here
{{/if}}