don't use cache for SSR
This commit is contained in:
parent
b9fdbde520
commit
e4aaaac20f
|
@ -38,14 +38,14 @@ export default async function getSSRApolloClient ({ req, res, me = null }) {
|
|||
assumeImmutableResults: true,
|
||||
defaultOptions: {
|
||||
watchQuery: {
|
||||
fetchPolicy: 'cache-only',
|
||||
nextFetchPolicy: 'cache-only',
|
||||
fetchPolicy: 'no-cache',
|
||||
nextFetchPolicy: 'no-cache',
|
||||
canonizeResults: true,
|
||||
ssr: true
|
||||
},
|
||||
query: {
|
||||
fetchPolicy: 'cache-first',
|
||||
nextFetchPolicy: 'cache-only',
|
||||
fetchPolicy: 'no-cache',
|
||||
nextFetchPolicy: 'no-cache',
|
||||
canonizeResults: true,
|
||||
ssr: true
|
||||
}
|
||||
|
|
|
@ -150,13 +150,15 @@ function getClient (uri) {
|
|||
initialFetchPolicy: defaultFetchPolicy,
|
||||
fetchPolicy: defaultFetchPolicy,
|
||||
nextFetchPolicy: defaultNextFetchPolicy,
|
||||
canonizeResults: true
|
||||
canonizeResults: true,
|
||||
ssr: SSR
|
||||
},
|
||||
query: {
|
||||
initialFetchPolicy: defaultFetchPolicy,
|
||||
fetchPolicy: defaultFetchPolicy,
|
||||
nextFetchPolicy: defaultNextFetchPolicy,
|
||||
canonizeResults: true
|
||||
canonizeResults: true,
|
||||
ssr: SSR
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -72,10 +72,6 @@ function MyApp ({ Component, pageProps: { ...props } }) {
|
|||
ssr data
|
||||
*/
|
||||
const { apollo, ssrData, me, price, ...otherProps } = props
|
||||
// if we are on the server, useEffect won't run
|
||||
if (SSR && client) {
|
||||
writeQuery(client, apollo, ssrData)
|
||||
}
|
||||
useEffect(() => {
|
||||
writeQuery(client, apollo, ssrData)
|
||||
}, [client, apollo, ssrData])
|
||||
|
|
Loading…
Reference in New Issue