when I make request with any hook, the request is sent three times before showing the error message.
How can I make to just send one request before handling the error?
2 Replies
Hi @Jaoc1811. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
In refine, the number of times a request is retried before showing an error message is controlled by the
retry
option in the queryOptions
property of hooks. By default, refine uses React Query for data fetching, which retries failed queries a few times before marking them as an error.
If you want to disable retries and make it so that only one request is sent before handling the error, you can set the retry
option to false
. You can do this for each hook individually, like so:
If you want to disable retries globally for all queries, you can do so in the ReactQueryClientConfig
section of the refineConfig
:
For more information, you can refer to the React Query documentation on query retries (https://react-query.tanstack.com/guides/query-retries#_top) and the refine documentation on the refineConfig (https://refine.dev/docs/core/components/refine-config/#reactqueryclientconfig).
Sources:
- Github Issue (closed): [BUG] @pankod/refine-nhost is not handling graphQL error responses > Comments Part 4 (https://github.com/refinedev/refine/issues/1794)
- Documentation > Docs > Guides-concepts > Data Fetching > Fetching Data > Code Files Part 2 (https://refine.dev/docs/guides-concepts/data-fetching#fetching-data)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@110864105035808768> kapa.ai is still learning and improving, please let us know how it did by reacting below