我正在使用apollo从服务器端渲染页面 . 它从后端完美装载 . 但是当它在前端加载时,再次调用graphql api . 我想防止这种情况 .
const client = new ApolloClient({
cache: new InMemoryCache({
cacheRedirects: {
Query: {
eventQuery: (_, args, { getCacheKey }) => getCacheKey({ __typename: 'Event', id: args.id }),
},
},
}).restore(window.__APOLLO_STATE__),
link: new HttpLink({
credentials: 'include',
uri: `/graphql`,
ssrForceFetchDelay: 2000,
}),
});
我曾尝试使用InMemoryCache进行补水 .