Skip to content
Discussion options

You must be logged in to vote

fetching: true doesn't really make much sense on these hooks, because it will give you the number of hooks that are currently fetching 🙃 .

What might works is using the predicate function to filter down to only queries that already have data, something like:

useIsFetching({ predicate: (query) => query.state?.data !== undefined })

or you could filter down to queries that are in the success state:

useIsFetching({ predicate: (query) => query.state?.status === 'success' })

because only a query that is successful can be re-fetched

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mojjominion
Comment options

Answer selected by mojjominion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants