Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: check for internet reachability before sync

Abdullah Atta60667149d461
diff --git a/apps/web/src/stores/app-store.js b/apps/web/src/stores/app-store.js
index 81515b79c..c2f0ed70c 100644
--- a/apps/web/src/stores/app-store.js
+++ b/apps/web/src/stores/app-store.js
@@ -287,8 +287,13 @@ class AppStore extends BaseStore {
};
sync = async (full = true, force = false) => {
- if (!this.get().isSyncEnabled || !navigator.onLine) return;
- if (this.isSyncing()) return;
+ if (
+ this.isSyncing() ||
+ !this.get().isSyncEnabled ||
+ !navigator.onLine ||
+ !(await networkCheck.waitForInternet())
+ )
+ return;
clearTimeout(syncStatusTimeout);
this.updateLastSynced();