-
-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Suggest adding a pattern to disable retry in react-query client in tests. This was something we discovered while investigating slow unit tests. By default react-query retries 3 times exponentially, having this rule allows to disable the retry thus allowing tests to run faster.
version: 0.0.1
patterns:
- name: react_query_client_disable_retry_in_test
tags: ['react-query', 'testing']
level: error
description: |
Disable retries in React Query client for testing.
body: |
`new QueryClient()` => `new QueryClient({ defaultOptions: { queries: { retry: false } } })`
samples:
- input: |
new QueryClient()
output: |
new QueryClient({ defaultOptions: { queries: { retry: false } } })There is probably a better way to do this, but the above pattern worked for us in our codebase.
For reference: Here is the doc. https://tanstack.com/query/v5/docs/framework/react/guides/testing#turn-off-retries
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels