Skip to content

Commit

Permalink
fix: add apollo cache policies
Browse files Browse the repository at this point in the history
  • Loading branch information
carcruz committed Oct 25, 2023
1 parent 447b6e0 commit 344159a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
19 changes: 14 additions & 5 deletions apps/platform/src/client.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
import { ApolloClient, InMemoryCache } from '@apollo/client';
import possibleTypes from './possibleTypes.json';
import config from './config';
import { ApolloClient, InMemoryCache } from "@apollo/client";
import possibleTypes from "./possibleTypes.json";
import config from "./config";

const client = new ApolloClient({
uri: config.urlApi,
cache: new InMemoryCache({
possibleTypes,
typePolicies: {
ScoredComponent: {
keyFields: ['componentId', 'score'],
keyFields: ["componentId", "score"],
},
Indications: {
keyFields: [],
},
MechanismsOfAction: {
keyFields: [],
},
Hallmarks: {
keyFields: [],
},
},
}),
headers: { 'OT-Platform': true },
headers: { "OT-Platform": true },
});

export default client;
9 changes: 9 additions & 0 deletions packages/sections/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ const client = new ApolloClient({
ScoredComponent: {
keyFields: ["componentId", "score"],
},
Indications: {
keyFields: [],
},
MechanismsOfAction: {
keyFields: [],
},
Hallmarks: {
keyFields: [],
},
},
}),
headers: { "OT-Platform": true },
Expand Down
9 changes: 9 additions & 0 deletions packages/ui/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ const client = new ApolloClient({
ScoredComponent: {
keyFields: ["componentId", "score"],
},
Indications: {
keyFields: [],
},
MechanismsOfAction: {
keyFields: [],
},
Hallmarks: {
keyFields: [],
},
},
}),
headers: { "OT-Platform": true },
Expand Down

0 comments on commit 344159a

Please sign in to comment.