Compare commits

...
4 changed files with 16 additions and 8 deletions
@@ -49,6 +49,9 @@ export const AppLoader = ({ children }: { children: ReactNode }) => {
const cacheConfig: InMemoryCacheConfig = { const cacheConfig: InMemoryCacheConfig = {
typePolicies: { typePolicies: {
Statistics: {
merge: true,
},
Account: { Account: {
keyFields: false, keyFields: false,
fields: { fields: {
@@ -80,12 +83,6 @@ const cacheConfig: InMemoryCacheConfig = {
ERC20: { ERC20: {
keyFields: ['contractAddress'], keyFields: ['contractAddress'],
}, },
PositionUpdate: {
keyFields: false,
},
AccountUpdate: {
keyFields: false,
},
Party: { Party: {
keyFields: false, keyFields: false,
}, },
@@ -95,8 +92,16 @@ const cacheConfig: InMemoryCacheConfig = {
Fees: { Fees: {
keyFields: false, keyFields: false,
}, },
// Don't cache order update as this subscription result gets merged into the main order cache // The folling types are cached by the data provider and not by apollo
// We don't need to write these to the cache at all PositionUpdate: {
keyFields: false,
},
TradeUpdate: {
keyFields: false,
},
AccountUpdate: {
keyFields: false,
},
OrderUpdate: { OrderUpdate: {
keyFields: false, keyFields: false,
}, },
@@ -94,6 +94,7 @@ export const accountsOnlyDataProvider = makeDataProvider<
update, update,
getData, getData,
getDelta, getDelta,
fetchPolicy: 'no-cache',
}); });
export interface AccountFields extends Account { export interface AccountFields extends Account {
@@ -197,6 +197,7 @@ const positionsDataProvider = makeDataProvider<
getDelta: (subscriptionData: PositionsSubscriptionSubscription) => getDelta: (subscriptionData: PositionsSubscriptionSubscription) =>
subscriptionData.positions, subscriptionData.positions,
getSubscriptionVariables, getSubscriptionVariables,
fetchPolicy: 'no-cache',
}); });
const positionDataProvider = makeDerivedDataProvider< const positionDataProvider = makeDerivedDataProvider<
@@ -99,6 +99,7 @@ export const tradesProvider = makeDataProvider<
append, append,
first: MAX_TRADES, first: MAX_TRADES,
}, },
fetchPolicy: 'no-cache',
getSubscriptionVariables: ({ marketId }) => ({ marketId }), getSubscriptionVariables: ({ marketId }) => ({ marketId }),
}); });