React Query Options: Enabled change does not disable/pause requests

Hi everyone, I am currently developing a page that incorporates various filters, some of which can become undefined upon selection. To manage this, I have set the queryOptions to enabled: false within the useTable hook whenever a filter changes to undefined. My intention is to pause the requests when the filter is undefined. However, I’ve encountered an issue where, once a request has been enabled for the first time, it does not become disabled. This results in continuous requests even though the queryOptions value has been altered. Has anyone else experienced a similar issue? Could this be an unmapped problem, or is there a known solution or workaround?
K
kapa.ai210d ago
Hi @mavissauro. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. However, I can provide some general guidance based on the information available. The useTable hook in refine uses the useList hook to fetch data and you can pass queryOptions to it. The queryOptions property is used to customize the behavior of the query, such as setting the retry option. However, the extracts do not mention the enabled option or its behavior when set to false.
useTable({
queryOptions: {
retry: 3,
},
});
useTable({
queryOptions: {
retry: 3,
},
});
(Source: refine.dev (https://refine.dev/docs/api-reference/antd/hooks/table/useTable/)) It's possible that the behavior you're experiencing is due to some specifics of how queryOptions or the useTable hook work that are not covered in the extracts. I would recommend checking the official documentation (https://refine.dev/docs) for more detailed information on these topics. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
K
kapa.ai210d ago
<@356568590356447242> kapa.ai is still learning and improving, please let us know how it did by reacting below
C
continuing-cyan209d ago
Hello @mavissauro your problem looks interesting, could you provide us a minimal reproducible example (codeblitz, codesandbox etc) so we can help you debug?