()
| 19 | }) |
| 20 | |
| 21 | export function makeQueryClient() { |
| 22 | return new QueryClient({ |
| 23 | defaultOptions: { |
| 24 | hydrate: { |
| 25 | /** |
| 26 | * Called when the query is rebuilt from a prefetched |
| 27 | * promise, before the query data is put into the cache. |
| 28 | */ |
| 29 | deserializeData: (data) => { |
| 30 | return tson.deserialize(data) |
| 31 | }, |
| 32 | }, |
| 33 | queries: { |
| 34 | staleTime: 60 * 1000, |
| 35 | }, |
| 36 | dehydrate: { |
| 37 | serializeData: (data) => { |
| 38 | return tson.serialize(data) |
| 39 | }, |
| 40 | shouldDehydrateQuery: (query) => { |
| 41 | return ( |
| 42 | defaultShouldDehydrateQuery(query) || |
| 43 | query.state.status === 'pending' |
| 44 | ) |
| 45 | }, |
| 46 | shouldRedactErrors: (error) => { |
| 47 | // Next.js automatically redacts errors for us |
| 48 | return false |
| 49 | }, |
| 50 | }, |
| 51 | }, |
| 52 | }) |
| 53 | } |
no test coverage detected