A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: only auto-reset sync status on sync complete
Abdullah Attae9a5f752a4d7
diff --git a/apps/web/src/stores/app-store.js b/apps/web/src/stores/app-store.jsindex c3a81c144..6edfca85d 100644--- a/apps/web/src/stores/app-store.js+++ b/apps/web/src/stores/app-store.js@@ -34,6 +34,7 @@ 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@@ -260,6 +261,7 @@ class AppStore extends BaseStore {if (!this.get().isSyncEnabled) return;if (this.isSyncing()) return;+ clearTimeout(syncStatusTimeout);this.updateLastSynced();this.updateSyncStatus("syncing");@@ -267,7 +269,7 @@ class AppStore extends BaseStore {const result = await db.sync(full, force);if (!result) return this.updateSyncStatus("failed");- else if (full) this.updateSyncStatus("completed");+ else if (full) this.updateSyncStatus("completed", true);await this.updateLastSynced();} catch (err) {@@ -291,9 +293,15 @@ class AppStore extends BaseStore {** @param {"synced" | "syncing" | "conflicts" | "failed" | "completed"} key*/- updateSyncStatus = (key) => {+ updateSyncStatus = (key, reset = false) => {logger.info(`Sync status updated: ${key}`);this.set((state) => (state.syncStatus = { key }));++ if (reset) {+ syncStatusTimeout = setTimeout(() => {+ this.updateSyncStatus("synced", false);+ }, 3000);+ }};isSyncing = () => {