Skip to content

Commit

Permalink
perf(graphql): Do not show logs on Apollo client and do better cachin…
Browse files Browse the repository at this point in the history
…g of shared information
  • Loading branch information
alt-art committed Oct 30, 2023
1 parent 92c2143 commit 6744bf4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/context/ApolloProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@ import {

const client = new ApolloClient({
uri: import.meta.env.VITE_SANITY_GRAPHQL_API_URL,
cache: new InMemoryCache(),
cache: new InMemoryCache({
typePolicies: {
Query: {
fields: {
Project: {
read(_, { args, toReference }) {
return toReference({
__typename: 'Project',
_id: args?.id,
});
},
},
},
},
},
}),
});

export default function ApolloProvider({
Expand Down
3 changes: 3 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ export default defineConfig({
},
}),
],
define: {
'globalThis.__DEV__': 'false',
},
});

0 comments on commit 6744bf4

Please sign in to comment.