2 Replies
Hi @japope. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To disable a query at page load for a resource in refine, you can use the
queryOptions
property with the enabled
option set to false
. This ensures that the query does not run automatically when the page loads.
Here is an example of how you can achieve this using the useShow
hook:
This approach can be applied to other data-related hooks like useMany
, useOne
, etc., by setting the enabled
option within queryOptions
.
For more information, you can refer to the following knowledge sources:
- How to ensure a query is only run after a certain variable is available and not on load (https://refine.dev/docs/guides-concepts/faq/#how-can-i-ensure-a-query-is-only-run-after-a-certain-variable-is-available-and-not-on-load)
- Adding queryOptions
to useShow
hook (https://github.com/refinedev/refine/issues/3023)
If you need to handle custom invalidation or other advanced scenarios, you can refer to the Custom Invalidation guide (https://refine.dev/docs/guides-concepts/forms/#custom-invalidation).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@465923409973477386> kapa.ai is still learning and improving, please let us know how it did by reacting below