-
-
Notifications
You must be signed in to change notification settings - Fork 866
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
With Apollo GraphQL Example #950
Conversation
PR for apollo with typescript example #891 |
link: createHttpLink({ | ||
uri: 'https://gql-placeholder.herokuapp.com/graphql', | ||
}), | ||
cache: new InMemoryCache(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working from the Apollo docs (https://www.apollographql.com/docs/react/features/server-side-rendering#store-rehydration), you'll want to swap this out for
cache: new InMemoryCache().restore(window.__APOLLO_STATE__)
might also want to add
ssrForceFetchDelay: 100,
defaultOptions: {
query: {
fetchPolicy: 'cache-and-network',
},
},
to avoid fetching data on the client-side that the server has already fetched.
// Pass your GraphQL endpoint to uri | ||
const client = new ApolloClient({ | ||
link: createHttpLink({ | ||
uri: 'https://gql-placeholder.herokuapp.com/graphql', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This URL doesn't appear to be valid any longer when directly accessed. The following URL does work though: http://gql-placeholder.herokuapp.com/playground.
Add an example of Razzle with Apollo GraphQL as requested on #509
This sample has the full SSR setup as described in the apollo graphql docs.