kadirahq / fast-render

Render you app even before the DDP connection is live. - magic?
MIT License
560 stars 80 forks source link

Automatic login broken with FlowRouter 2.12.2 and Meteor 1.3.3.1 #173

Closed abecks closed 7 years ago

abecks commented 7 years ago

When returning to the application after logging in (refresh, etc.), FlowRouter initializes before the user has been logged in. Meteor.user() is null and Meteor.loggingIn() is false. Any triggers that require the user to be logged in will act as if they are not. This means all I see is the login screen when refreshing my application, even though after it loads, Meteor.user() shows that I am logged in.

The routes run before the "fast rendering completed!" message. I am trying to use FlowRouter.wait() and FlowRouter.initialize() as a workaround, but I can't figure out what hook to use. Meteor.loggingIn() is ALWAYS false.

quintstoffers commented 7 years ago

Could you have a look to see if Meteor.userId() does return the correct user ID? We're currently seeing similar behaviour, and it seems like this is caused by the bulk processing that was recently introduced to MiniMongo. We're getting a userId, but no user document in our FlowRouter triggers.

FastRender inserts the user before calling Meteor.user() as the logs prove. I'm guessing that MiniMongo is awaiting more documents to be inserted, meanwhile our triggersEnter run and don't get a user document. As a workaround one could try fetching the user from FlowRouter's payload (FlowRouter.debugger.getPayload()) and fetch the user document from there to figure out the routing.

Either way, this is likely the same issue as #168.

SachaG commented 7 years ago

Any news on this? Now that Meteor 1.4 is out, it'd be great to be able to update.

SachaG commented 7 years ago

See also: https://github.com/kadirahq/fast-render/issues/176

abecks commented 7 years ago

I guess fast render has been abandoned.