Newer Version Available
Determine Online or Offline Status
Online vs. offline connectivity is dynamic, and the signal given to the app from the mobile operating system is notoriously unreliable. This lack of a clear signal is because the state of connectivity changes frequently. Connectivity isn’t a simple on/off switch. There’s a range, from totally offline, to spotty, to slow-but-solid, and all the way up to faster than wired speed in the best circumstances. There’s no good way to know if an action that requires a network connection will succeed or fail, except by attempting it.
In general, our design goal is that LWCs work offline first, and treat being offline as a normal condition, not a failure. When a network request doesn’t succeed, the condition is handled as gracefully as possible. We recommend your components adhere to this practice.