Fix offline capability: Cache first -> fetch from network second. From now on, updates are only possible by increasing cacheVersion

This commit is contained in:
schlagmichdoch 2023-10-12 18:57:26 +02:00
parent 8eb6e5bfab
commit 2131307fc6
6 changed files with 86 additions and 58 deletions

View file

@ -37,7 +37,7 @@ class ServerConnection {
_connect() {
clearTimeout(this._reconnectTimer);
if (this._isConnected() || this._isConnecting()) return;
if (this._isConnected() || this._isConnecting() || this._isOffline()) return;
if (this._isReconnect) {
Events.fire('notify-user', {
message: Localization.getTranslation("notifications.connecting"),
@ -246,6 +246,10 @@ class ServerConnection {
return this._socket && this._socket.readyState === this._socket.CONNECTING;
}
_isOffline() {
return !navigator.onLine;
}
_onError(e) {
console.error(e);
}