Skip to content

When using useQuery with suspense true option, staleTime defaults to 1000ms right? #5162

Answered by TkDodo
pys99pys asked this question in Q&A
Discussion options

You must be logged in to vote

it's an implementation detail, but we cannot default to zero because of how suspense works. suspense unmounts the component and shows the suspense fallback component instead. Then, it re-mounts the component once it's ready. With a staleTime of zero, this would lead to another refetch, which is unwanted. The small staleTime prevents this.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@pys99pys
Comment options

@custardcream98
Comment options

Answer selected by pys99pys
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