webapp/src/graphql/cache.ts

15 lines
418 B
TypeScript
Raw Normal View History

2022-09-09 11:53:35 +00:00
import { cacheExchange, CacheExchangeOpts } from '@urql/exchange-graphcache'
2022-11-21 06:35:32 +00:00
2022-09-09 11:53:35 +00:00
// import schema from './introspec.gen'
2022-11-21 06:35:32 +00:00
// NOTE: include codegened introspection schema when needed
2022-09-09 11:53:35 +00:00
2022-11-21 06:35:32 +00:00
// TODO: use urql-provided caching
2022-09-09 11:53:35 +00:00
export const cache = cacheExchange({
keys: {
Shout: (data) => data.slug,
Author: (data) => data.slug,
Topic: (data) => data.slug,
Reaction: (data) => data.id
}
} as CacheExchangeOpts)