Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback for “Server Side Rendering” #2050

Open
chriswoodie opened this issue Jul 6, 2023 · 1 comment
Open

Feedback for “Server Side Rendering” #2050

chriswoodie opened this issue Jul 6, 2023 · 1 comment

Comments

@chriswoodie
Copy link

I don't understand this block. At no point am I manually calling Apollo.create, nor does https://the-guild.dev/graphql/apollo-angular/docs/get-started mention anything about this, despite this block referring to it.

You saw how to use Server-Side Rendering and Store Rehydration in your application, but you will need to be a little careful in how you create Apollo on the server to ensure everything works there as well:
When creating Apollo (Apollo.create) on the server, you'll need to set up your HttpLink to connect to the API server correctly. This might look different to how you do it on the client, since you'll probably have to use an absolute URL to the server if you were using a relative URL on the client.
Since you only want to fetch each query result once, pass the ssrMode: true option to the Apollo.create to avoid repeated force-fetching.
You need to ensure that you create a new client or store instance for each request, rather than re-using the same client for multiple requests. Otherwise, the UI will be getting stale data, and you'll have problems with authentication.

Can you clarify if this is still relevant and if so, what exactly do you have to do?

@Blunderchips
Copy link

Are there any example/demo application that use this library and SSR together?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants