oxidecomputer / console

Oxide Web Console
https://console-preview.oxide.computer
Mozilla Public License 2.0
128 stars 10 forks source link

Offline banner #1100

Open david-crespo opened 2 years ago

david-crespo commented 2 years ago

Low priority but also extremely easy. Turns out we can trivially tell when the network connection is down.

import { onlineManager } from '@tanstack/react-query'

// ...
{!onlineManager.isOnline() && <OfflineError />}
david-crespo commented 2 months ago

This is not a very high priority, but I was curious what happens now if you try to nav when you are offline. We will attempt to load and hang forever with the loading bar halfway filled.

image
david-crespo commented 1 month ago

Important: onlineManager does not really solve the problem here. That just listens for the online and offline events on window, which are triggered by changes in internet connectivity overall, like turning wi-fi on or off. But if the rack is behind a VPN, onlineManager would not detect when you disconnect from VPN. We'd have to be polling or something. Probably better to simply have requests time out eventually and do something informative when they do, like show a modal or a banner or even land on an error page.