Skip to content

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

fix: do not sync if sync already running

thecodrrd7c8f2da8e45
diff --git a/apps/web/src/components/status-bar/index.js b/apps/web/src/components/status-bar/index.js
index 5ecf95567..f7cfa8e1a 100644
--- a/apps/web/src/components/status-bar/index.js
+++ b/apps/web/src/components/status-bar/index.js
@@ -175,7 +175,7 @@ function SyncStatus() {
<Button
variant="statusitem"
display="flex"
- onClick={sync}
+ onClick={() => sync()}
sx={{ alignItems: "center", justifyContent: "center" }}
title={status.tooltip}
data-test-id={`sync-status-${status.key}`}
diff --git a/apps/web/src/stores/app-store.js b/apps/web/src/stores/app-store.js
index 3f4db9d6f..c9afcf178 100644
--- a/apps/web/src/stores/app-store.js
+++ b/apps/web/src/stores/app-store.js
@@ -176,6 +176,8 @@ class AppStore extends BaseStore {
};
sync = async (full = true, force = false) => {
+ if (this.isSyncing()) return;
+
clearTimeout(syncStatusTimeout);
this.updateLastSynced();
@@ -220,6 +222,11 @@ class AppStore extends BaseStore {
logger.info(`Sync status updated: ${key}`);
this.set((state) => (state.syncStatus.key = key));
};
+
+ isSyncing = () => {
+ const status = this.get().syncStatus.key;
+ return status === "syncing";
+ };
}
/**