Skip to content

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

web: do not auto reset sync status after 3 seconds

Abdullah Atta370ba5420ace
diff --git a/apps/web/src/stores/app-store.js b/apps/web/src/stores/app-store.js
index f8398da35..c3a81c144 100644
--- a/apps/web/src/stores/app-store.js
+++ b/apps/web/src/stores/app-store.js
@@ -34,7 +34,6 @@ import { EV, EVENTS, SYNC_CHECK_IDS } from "@notesnook/core/common";
import { logger } from "../utils/logger";
import Config from "../utils/config";
-var syncStatusTimeout = 0;
const BATCH_SIZE = 50;
class AppStore extends BaseStore {
// default state
@@ -103,6 +102,11 @@ class AppStore extends BaseStore {
}
);
+ db.eventManager.subscribe(EVENTS.syncAborted, (error) => {
+ showToast("error", error);
+ this.updateSyncStatus("failed");
+ });
+
db.eventManager.subscribe(EVENTS.syncCompleted, () => {
this.set((state) => {
state.syncStatus = { key: "synced" };
@@ -256,7 +260,6 @@ class AppStore extends BaseStore {
if (!this.get().isSyncEnabled) return;
if (this.isSyncing()) return;
- clearTimeout(syncStatusTimeout);
this.updateLastSynced();
this.updateSyncStatus("syncing");
@@ -281,11 +284,6 @@ class AppStore extends BaseStore {
if (err?.message?.indexOf("Failed to fetch") > -1) return;
showToast("error", err.message);
- } finally {
- if (this.get().syncStatus.key !== "conflicts")
- syncStatusTimeout = setTimeout(() => {
- this.updateSyncStatus("synced");
- }, 3000);
}
};