Skip to content

[v2] stuck on isLoading when I setQueryData for initial load #649

Answered by tannerlinsley
huchenme asked this question in General
Discussion options

You must be logged in to vote

Pretty sure the reason for this is:

  • You are attempting to set the query data after the query has started to load. Setting the query data with setQueryData will not bring a query out of a loading mode.
  • Instead of using the initialData as is prescribed and designated in the docs, you are using setQueryData imperatively. The only way to use setQueryData and avoid the loading state is to ensure that it is done before the query for it loads.

https://codesandbox.io/s/react-query-2-setquerydata-9rm0m?file=/src/index.js

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@huchenme
Comment options

@tannerlinsley
Comment options

@huchenme
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by huchenme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #649 on June 28, 2020 16:04.