React-query: refetchOnWindowFocus necessary for inactive queries?

Created on 12 Mar 2020  Â·  5Comments  Â·  Source: tannerlinsley/react-query

Hi, I have a page with some data and a faceted search, a new search request is executed every time I add a filter (as expected), but if I change to another window and then return, the refetchOnWindowFocus executes not only for the current query but all inactive search queries.

Is there a usefulness to this behavior that I'm not seeing?

Can we maybe add some way to avoid this? I can do the PR.

(react-query version 1.0.17)

Most helpful comment

Interesting. I’ll take a deeper look at this
On Mar 12, 2020, 9:28 AM -0600, Ivo Anastácio notifications@github.com, wrote:

@tannerlinsley please check the video, to the best of my understanding the queries are inactive.
http://somup.com/cYeloOhkkL
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

All 5 comments

It shouldn't be refetching inactive queries, only stale queries. Are you sure they are inactive and not stale?

@tannerlinsley please check the video, to the best of my understanding the queries are inactive.

http://somup.com/cYeloOhkkL

Interesting. I’ll take a deeper look at this
On Mar 12, 2020, 9:28 AM -0600, Ivo Anastácio notifications@github.com, wrote:

@tannerlinsley please check the video, to the best of my understanding the queries are inactive.
http://somup.com/cYeloOhkkL
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

I confirm, here's a codesanbox: https://codesandbox.io/s/goofy-thunder-kzfgw

I'll submit a PR later

Wow, that was fast :D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rutzfutz picture rutzfutz  Â·  5Comments

the133448 picture the133448  Â·  4Comments

wolverineks picture wolverineks  Â·  6Comments

bgazzera picture bgazzera  Â·  4Comments

tiagoengel picture tiagoengel  Â·  5Comments