Skip to content

Commit

Permalink
feat(use-data-query): set conservative defaults for caching
Browse files Browse the repository at this point in the history
  • Loading branch information
ismay committed Jul 12, 2021
1 parent 218bdb6 commit e5e4f69
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion services/data/src/react/components/DataProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,22 @@ export interface ProviderInput {
children: React.ReactNode
}

const queryClient = new QueryClient()
const queryClient = new QueryClient({
defaultOptions: {
queries: {
// Disable automatic error retries
retry: false,
// Don't retry on mount if query has errored
retryOnMount: false,
// Refetch on mount if data is stale
refetchOnMount: true,
// Don't refetch when the window regains focus
refetchOnWindowFocus: false,
// Don't refetch after connection issues
refetchOnReconnect: false,
},
},
})

export const DataProvider = (props: ProviderInput) => {
const config = {
Expand Down

0 comments on commit e5e4f69

Please sign in to comment.