redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

refetchOnFocus and isLoading / isFetching

Open SamyZog opened this issue 3 years ago • 1 comments

I have a client side react app, navigation is done using react router v 6.

In the root component (always mounted), I have a hook query with the flag refetchOnFocus = true

const { isLoading } = useMyQuery(undefined, { refetchOnFocus: true })

if (isLoading) return <Spinner />

the problem is that each time I focus the tab, isLoading is always true, is this the correct behavior?? I thought that isLoading only fires on first mount and then isFetching runs each time I focus the tab??

SamyZog avatar Aug 18 '22 10:08 SamyZog

It should... Can you create a reproduction or replay of this?

phryneas avatar Aug 18 '22 13:08 phryneas