QueryRenderer timeout for poor offline conditions
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
**The problem**
We are trying to build an app that works under a variety of network conditions using Relay. We have handled the fully offline case (effectively 'when offline, use cache' - helped by the fantastic [React Relay Offline library](https://github.com/morrys/react-relay-offline)!).
This works well for most cases. However, a common situation is 'effectively offline'. This is where the phone technically has signal, but it is too weak to fetch any data.
For certain screens we would prefer to use the `network-only` `fetchPolicy`, because we need new data, and we don't want to show the cached data before new data arrives a few seconds later.
However, for these screens in 'effectively offline' conditions, we just see an infinite loading spinner.
**Possible solution**
The behaviour I often see with other apps here (e.g. Spotify) is a query timeout. It will try and fetch data, then if it doesn't receive it, it will fall back to what's in the cache (if available).
To achieve this, would it make sense to add an optional `timeout` option for `network-only` `fetchPolicy`s.
Is this something you have considered? Or am I missing another way of handling this situation?
Contributor guide
Assessment
This issue has not been assessed yet.