currentUser is causing a blink in my site when loading



There is a blink in my site:

{{#unless currentUser}}
<ul class="nav navbar-nav">
    <a href="#" class="js-facebook-login btn btn-social btn-lg btn-facebook btn-flat">
      <i class="fa fa-facebook"></i> Inicia sesión con Facebook</a>
    <a href="#" class="js-facebook-register btn btn-social btn-lg btn-facebook btn-flat">
      <i class="fa fa-facebook"></i> Regístrate con Facebook</a>

I know I can create a template helper that returns Meteor.loggingIn()
I am using Blaze, what is the correct approach ?


The cleanest and easiest solution to this that I have found is to install starringatlights:fast-render. This will send down the data for the currently logged in user with the HTML payload.


Thanks for your reply, when I include my routes.js on server side, my app breaks because it can not find jQuery


What is your opinion about



You shouldn’t need to include your routes.js on the server. Just install the package and it should work out of the box to publish the currently logged in user in the html for the page. The documentation says to move your code, but that’s to include data for the route as well. This won’t be necessary just for the data of the currently logged in user.

1 Like

For global global subscriptions, you might try a null publication. This would automatically publish this data that you need for the app without the need to actually subscribe to it on the client.

Meteor.publish(null, function() {
    //return cursor or array of cursors here
}, {is_auto: true});