Replies: 1 comment 5 replies
-
That's a very good point I actually wasn't aware of. We're updating our browserlist for v5, so this seems like a good moment to reflect on if that is still needed. I'm aware of the " What you are saying makes sense to me - would you like to contribute this change to the |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello 👋
Right now, React Query has
refetchOnWindowFocus
set totrue
by default. And the default "focus" detection logic looks like this:query/src/core/focusManager.ts
Lines 58 to 74 in 5285479
As you can see, the focus manager listens to
visiblitychange
andfocus
events by default.💡 I'm wondering if it makes sense to stop listening to
focus
event and listen only tovisibilitychange
. 💡To me, it seems that we're supporting both events just for historical reasons, as
visiblitychange
wasn't fully supported in some old browsers which are dropped now (e.g. IE11 💀).The
focus
event has many pitfalls, as it's triggered in the following cases:alert
orconfirm
dialog.And this can result in a bad UX.
I know that it's possible to customize this event as shown here: https://tanstack.com/query/v4/docs/react/guides/window-focus-refetching#custom-window-focus-event
But this discussion is about the default behavior. I think the library should provide the best possible experience out of the box.
Beta Was this translation helpful? Give feedback.
All reactions