Apollo query not resolving in expo-background-fetch

SDK 46 on android

I just found a weird behavior in my application:

The app uses expo-background-fetch to sync data with a GraphQL server every 10 minutes and set a local time stamp for the time of last sync. I noted that at any amount of time > 10 minutes, when I open the app, the last sync time is always ‘just now’. It seems that all requests are just held in loading state as long as the app is in background and get executed when the app is in foreground again. That is quite unfortunate for background data fetch …

I prepared a small example app to demonstrate my issue:

The app starts and registers the task.
After sending the app to background, the task gets executed.
The request to the server reports as LOADING.
But it never gets resolved until you bring the app back to foreground.
Than, suddenly all queries made by task executions in the meantime get resolved.

I would expect the queries to be executed and resolved immediately.
Am I wrong? Do I have to configure something differently when performing requests in background?

Appendix:
expo GO app is allowed to use background data and has android energy optimization disabled.

I posted an issue on this topic for @apollo/client

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.