Skip to content

Is there a way to detect when URQL determines it is offline? #1167

Answered by kitten
JohnAtFenestra asked this question in Q&A
Discussion options

You must be logged in to vote

There are multiple indicators, but basically we're currently working with the assumption that knowing when urql thinks it's online again is more important. The main indicator that @urql/exchange-graphcache contains to check whether it's offline is passive. It looks at results and if it sees that a network error of a particular shape and message has occurred it assumes it's been offline: https://github.com/FormidableLabs/urql/blob/f3cf0c9685f41257b86b6b3a88512ccfc7883b02/exchanges/graphcache/src/offlineExchange.ts#L58-L65

It then uses what you pass for storage.onOnline to determine when to assume it's back online. So you can in theory piggy back on that and make storage.onOnline more compl…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by kitten
Comment options

You must be logged in to vote
1 reply
@kitten
Comment options

Comment options

You must be logged in to vote
1 reply
@kitten
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants