kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 193 forks source link

[SSR] User undefined in triggersEnter method if you open the app in a new tab #604

Closed dufia closed 8 years ago

dufia commented 8 years ago
triggersEnter: [function(context, redirect) {
    const user = Meteor.users.findOne({_id: Meteor.userId()})
    console.log(user) // undefined
  }]

I use kadira:flow-router-ssr@3.12.2

If you open new tab and go to the route, user will be undefined. If you refresh or trigger route with FlowRouter.go it will be defined. This makes redirecting based on privilages impossible.

dufia commented 8 years ago

I am closing the issue. I've solved it but I don't know how. I've removed parts of my app one by one until the issue wen't away, then I began to put it back together until the issue came back. It didn't came back and I don't know why.