apollo: fix caching

This commit is contained in:
vchikalkin 2023-03-10 14:39:31 +03:00
parent 5a73a9c8a3
commit 7a91f870fa
2 changed files with 4 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import { cache, link } from '@/config/apollo';
import { ApolloClient } from '@apollo/client';
import { link } from '@/config/apollo';
import { ApolloClient, InMemoryCache } from '@apollo/client';
import { isServer } from 'tools/common';
/** @type {import('@apollo/client').ApolloClient<import('@apollo/client').NormalizedCacheObject>} */
@ -7,7 +7,7 @@ let apolloClient;
function createApolloClient() {
return new ApolloClient({
cache,
cache: new InMemoryCache(),
link,
ssrMode: isServer(),
});

View File

@ -1,10 +1,8 @@
import getUrls from './urls';
import { ApolloLink, HttpLink, InMemoryCache } from '@apollo/client';
import { ApolloLink, HttpLink } from '@apollo/client';
const { URL_CRM_GRAPHQL } = getUrls();
export const cache = new InMemoryCache();
const modifyDataLink = new ApolloLink((operation, forward) => {
const context = operation?.getContext();