apollographql / apollo-client

:rocket: Β A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.32k stars 2.65k forks source link

Query not executed in expo-background-fetch #10446

Open qroac opened 1 year ago

qroac commented 1 year ago

Issue Description

expo-background-fetch executes periodic tasks when the react-native app is in background. Using apollo client to query a graphql api, the query stays in state loading as long as the app is in background. After bringing the app back to foreground, all queries from background jobs get executed and resolved. For periodic syncing of data in background, this is quite unfortunate.

PS: My demo app can be executed with expo Go on an android smartphone I checked that expo Go had permission to use background data and had android energy optimization disabled.

Link to Reproduction

https://github.com/qroac/apollo-expo-background-demo

Reproduction Steps

Example app provided in link to reproduction

bignimbus commented 1 year ago

Hi @qroac πŸ‘‹πŸ» thanks for opening this issue! Given the nature of this issue we may take a while to investigate and prioritize it but we are definitely interested in finding out what might be going on here. Thanks in advance for your patience πŸ™πŸ»

qroac commented 1 year ago

Hi @bignimbus Thanks for picking up my issue. I'm aware that this might go way deeper than OSI layer 7 and could be hard to find. I really appreciate the work of the apollo team and wait for news on this issue. If I can provide any more info that might be helpful or test a potential bugfix, let me know.

In the meantime I'll urge my users to regularly open the app to get the data synced ;)

frankcalise commented 2 months ago

@qroac have you revisited this issue lately in a later version of Expo at all?