Skip to content
Discussion options

You must be logged in to vote

tl;dr Replace initialData with placeholderData and add staleTime.

initialData is treated as you have the valid data for that query and staleTime is calculated from the last fetch, but initial fetch would not happend if initialData and staleTime is set.
You are hinting that you have valid data for that query and it should be valid for staleTime.

By setting placeholderData you are hinting that it should be rendered initially, but you do not have any valid data for it, so initial fetch would be triggered.

Hope that clarifies things.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by kboul
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
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