For most of my app I avoid trying to render authenticated routes with SSR. I figure if the user is committed enough to use the app, they’ll stick around with slightly longer refresh times for authenticated routes, and bots aren’t authenticated anyway. But there are a few edge cases where I want to sprinkle logged-in touches here and there, and without
Meteor.user available during SSR, I get differing HTML on the client - which breaks hydration.
Basically, we need
Meteor.user during hydration. Anyone know of a way to get it?
I think if I call a Method from inside
onPageLoad, that method will have access to this information - I’m going to try and grab the info that way, then override the built-ins, and see if it works. If anyone has figured this out yet, I’d love a pointer or two! Update: This didn’t work -in retrospect, that makes sense, since the server doesn’t have access to the security token. I assume when a method is invoked from the client app it sends that. That must be why fast-render sends it along with a cookie. I’ll look into using a technique like that.