Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iron-router waitOn Meteor.user()

I would use Meteor.user() in data iron-router, but this is undefined at start...

I'm trying with:

waitOn: function() {
   return curretUserHandle;
},
data: function() {
   // access to Meteor.user().username, give me undefined

[...]

var curretUserHandle = {
    ready: function () {
        return 'undefined' !== typeof Meteor.user();
    }
};

but data function of route is always call before curretUserHandle.ready() return true

I know that i can add if(Meteor.user()) in data, but this option don't like.

Why data don't wait that Meteor.user() is ready?

like image 511
elbowz Avatar asked Aug 16 '14 08:08

elbowz


1 Answers

Adding https://atmospherejs.com/meteorhacks/fast-render 'magically' solves this.

However, please read the note on necessary security measures: https://meteorhacks.com/fast-render/security-measures/

like image 141
workflow Avatar answered Sep 23 '22 15:09

workflow