Closed xavxyz closed 7 years ago
@xavcz I just submitted PR for issue #56, didn't noticed yours. But why did you add isSSR
which is not related to apollo?
Haha, great to see that we want this package to be improved!! π
I believe you mean ssrMode
instead of isSSR
? It's an option on the ApolloClient
constructor: http://dev.apollodata.com/core/apollo-client-api.html#ApolloClient.constructor
We are using a fork of this package with a similar setup on Nova (Telescope with React & Apollo) and it works great! The Apollo Client exists server-side, and the server-side rendering is done with the current user in the queries linked to the components walked by react-apollo
.
Hey @lorensr (last time I ping you today, promise π),
I have to admit I'm pretty glad you didn't merged (or refused π¨ ) this PR yet, I've fixed a pretty annoying bug!
When doing server-side rendering, the cookie could have still be stored even if the user had logged out, causing weird client interactions when a part of the UI depends on the current user (endured for two months on Telescope Nova powered with Apollo).
Note: this PR has been proofed on Nova (i.e. React / Apollo / Meteor app)...it's working great! π
PR opened on the docs π
Thank you βΊοΈ
Hey!
This PR is intended to fix #56.
I've also added the support for a custom
loginToken
in the config to be able to ssr-ing with an Apollo Client knowing about the current user in its requests.The
Accounts._storedLoginToken
fn access to the local storage to grab the token, however as it doesn't exist server-side, we'll be unable to get any token the way it was written before.The workaround here if someone is doing SSR with
apollo
meteor package and want to have the current user info pre-loaded is to usefast-render
and to pass the cookiemeteor_login_token
into themeteorClientConfig
.What do you think?
ps: merry christmas ππ