isPending true even when query is not enabled #7329
Replies: 4 comments 3 replies
-
Basically from the docs, if I want to ensure query.data is valid and is based on being enabled, what should be used? |
Beta Was this translation helpful? Give feedback.
-
please read this guide: https://tanstack.com/query/latest/docs/framework/react/guides/queries and this one: https://tanstack.com/query/latest/docs/framework/react/guides/disabling-queries
|
Beta Was this translation helpful? Give feedback.
-
@TkDodo but isn't this misleading as enabled false means we donot need data right now so if we don't want anything to be fetched so why would isPending be true as isPending means query is loading but here we never hit the api so it should be like pending should be false and after enabled is true then only pending should be true basically u mean that if we use enabled than fetchStatus is idle but the pending state is true? |
Beta Was this translation helpful? Give feedback.
-
I also think it's weird behavior, +1, as I prefer better source of truth when thinking of "request is not ready". |
Beta Was this translation helpful? Give feedback.
-
Hi there!
I had a question, I'm using react-query with conditional enabling of a query.
I've confirmed that my query is not enabled, but when I have my check for isPending, I see that it is
I've checked that type === B when doing this, but still when doing:
query.isPending is true and Loading is returned -- why would that be the case? We recently migrated from v4 to v5 so this used to be isLoading
Beta Was this translation helpful? Give feedback.
All reactions