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,
|
assumeImmutableResults: true,
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
watchQuery: {
|
watchQuery: {
|
||||||
fetchPolicy: 'cache-only',
|
fetchPolicy: 'no-cache',
|
||||||
nextFetchPolicy: 'cache-only',
|
nextFetchPolicy: 'no-cache',
|
||||||
canonizeResults: true,
|
canonizeResults: true,
|
||||||
ssr: true
|
ssr: true
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
fetchPolicy: 'cache-first',
|
fetchPolicy: 'no-cache',
|
||||||
nextFetchPolicy: 'cache-only',
|
nextFetchPolicy: 'no-cache',
|
||||||
canonizeResults: true,
|
canonizeResults: true,
|
||||||
ssr: true
|
ssr: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,13 +150,15 @@ function getClient (uri) {
|
||||||
initialFetchPolicy: defaultFetchPolicy,
|
initialFetchPolicy: defaultFetchPolicy,
|
||||||
fetchPolicy: defaultFetchPolicy,
|
fetchPolicy: defaultFetchPolicy,
|
||||||
nextFetchPolicy: defaultNextFetchPolicy,
|
nextFetchPolicy: defaultNextFetchPolicy,
|
||||||
canonizeResults: true
|
canonizeResults: true,
|
||||||
|
ssr: SSR
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
initialFetchPolicy: defaultFetchPolicy,
|
initialFetchPolicy: defaultFetchPolicy,
|
||||||
fetchPolicy: defaultFetchPolicy,
|
fetchPolicy: defaultFetchPolicy,
|
||||||
nextFetchPolicy: defaultNextFetchPolicy,
|
nextFetchPolicy: defaultNextFetchPolicy,
|
||||||
canonizeResults: true
|
canonizeResults: true,
|
||||||
|
ssr: SSR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -72,10 +72,6 @@ function MyApp ({ Component, pageProps: { ...props } }) {
|
||||||
ssr data
|
ssr data
|
||||||
*/
|
*/
|
||||||
const { apollo, ssrData, me, price, ...otherProps } = props
|
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(() => {
|
useEffect(() => {
|
||||||
writeQuery(client, apollo, ssrData)
|
writeQuery(client, apollo, ssrData)
|
||||||
}, [client, apollo, ssrData])
|
}, [client, apollo, ssrData])
|
||||||
|
|
Loading…
Reference in New Issue