Skip to content

<Suspense> fallback component not rendered when refetch() #8346

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

You must be logged in to vote

fallback components are rendered on the initial loading but never following a call to refetch()

This is on purpose because we only suspend when there is no other way - meaning we have no data to show. Stale data is always preferred to a loading spinner. If we wouldn’t do that, our automatic refetches (e.g. on window focus) would also re-suspend, which isn’t good.

calling refetch on a button click has a very specific use-case: re-fetching with the same arguments. I don’t see this too often in the wild. What’s usually the case is that clicking the button changes something that serves as an input to the query, and then, if new data for that input doesn’T yet exist, we suspend.

If you real…

Replies: 1 comment 1 reply

Comment options

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

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