Skip to content
Discussion options

You must be logged in to vote

There have been other discussions about this, the reason is always the same thing:

  1. parent fetches, then, after it has finished fetching, it will render child
  2. child will trigger a background refetch because refetchOnMount defaults to true and staleTime defaults to zero.
  3. that background refetch makes isFetching: true, which will trigger a re-render of the parent and unmount Child (in case of !isFetching && <Child />)
  4. when the background refetches finishes, the parent will mount Child again, putting you right back at 2) and you'll go infinite.

you probably don't want to unmount Child whenever the query isFetching - maybe you meant to check for isLoading instead?
Also, you might want to se…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

@TkDodo
Comment options

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