Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window Focus Refetching #125

Open
redbar0n opened this issue Jan 6, 2021 · 1 comment
Open

Window Focus Refetching #125

redbar0n opened this issue Jan 6, 2021 · 1 comment

Comments

@redbar0n
Copy link

redbar0n commented Jan 6, 2021

Mirroring issue 3312 from Relay since it is a discussion there whether or not this should be handled in the Network Layer. If so, then it would be great if it was possible here.

Rising libraries such as SWR or React Query support focus refetching, meaning that the client will not poll if the user has switched to a different tab or window, and it will immediately fetch again if the user comes back to the tab. This saves a lot of wasted requests, while maintaining a great UX.

According to React Query's and URQL's comparison pages then it seems like Relay Modern Network Layer doesn't support Window Focus Refetching. Since it is not listed as an availability for Relay through any 3rd party library like this.

Above quote is from the similar request for Apollo Client. It has details and example code on how SWR and React Query implement window focus refetching, with a code sandbox example showing it, too. That might help for inspiration and/or discussion on a potential concrete implementation.

With the caveat that the URQL comparison page seems to have overlooked this react-relay-network-modern library, as it is referencing the classic react-relay-network-layer.

Does Window Focus Refetching make sense for Relay Modern Network Layer? If so, is it already baked in (contrary to what the above comparisons)? If not, is it on the roadmap? If not, why not?

@nodkz
Copy link
Collaborator

nodkz commented Jan 6, 2021

I'm not using Relay now in our projects. So there is no reason for me to do this. BUT I'll be very happy to accept PR with such improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants