Skip to content
Discussion options

You must be logged in to vote

useQuery "optimistically" gets you into loading / fetching state when it knows that it will trigger a fetch "soon". E.g. on the first render, we give you back fetching: true even though we haven't fetched yet, as this has to happen in an effect under the hood.

If we wouldn't do that, every place where you had useQuery would give you back a render where fetching would be false, followed by an immediate one where fetching is true.

The useIsFetching hook on the other hand cannot do that because it doesn't have that information.

isLoadingFromHook is also 0 because useIsFetching implicitly checks for fetching state :)

So it's kinda intended. Hope that explains it :)

Replies: 1 comment 1 reply

Comment options

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

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