react-detect-offline
react-detect-offline copied to clipboard
navigator.onLine false positives
The component currently fails to detect offline status reliably and produces many false positives.
From the navigator.onLine doc: while you can assume that the browser is offline when it returns a false value, you cannot assume that a true value necessarily means that the browser can access the internet.
Relying on navigator.onLine
to detect offline
status is a good idea. Relying on it to detect online
status is not.
I suggest changing to reflect this, basically the logic would go like !navigator.online ? definitelyOffline : pollToDetectOnline
If that makes sense, I can PR this. I understand there's a concern with the polling volume and we don't want to be wasteful but as it currently is, there are tons of false positive conditions.
Hey @ash0x0 We have logic that determines the Browser being used in the user agent. This should prevent any false positives like you are mentioning as they all have different definitions of "online". Can you share a sandbox or example of the false positives ? Particularly , what user agent is causing the false positives?
For me it was electron 12, which is chromium 89. Not sure if electron 13 has the same problem but 11 certainly does.
@ash0x0 It may be the issue of the object's state mutation.