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: cancel attachments caching on disabling offline mode
Abdullah Atta5357be4741cf
diff --git a/apps/web/src/stores/setting-store.ts b/apps/web/src/stores/setting-store.tsindex 046d22c3a..316d5fd24 100644--- a/apps/web/src/stores/setting-store.ts+++ b/apps/web/src/stores/setting-store.ts@@ -209,10 +209,13 @@ class SettingStore extends BaseStore<SettingStore> {await desktop?.updater.toggleAutoUpdates.mutate({ enabled: !autoUpdates });};- toggleFullOfflineMode = async () => {+ toggleFullOfflineMode = () => {const isFullOfflineMode = this.get().isFullOfflineMode;this.set({ isFullOfflineMode: !isFullOfflineMode });Config.set("fullOfflineMode", !isFullOfflineMode);++ if (isFullOfflineMode) db.fs().cancel("offline-mode");+ else db.attachments.cacheAttachments();};}diff --git a/packages/core/src/api/sync/index.ts b/packages/core/src/api/sync/index.tsindex 6350bfcb7..330afea4b 100644--- a/packages/core/src/api/sync/index.ts+++ b/packages/core/src/api/sync/index.ts@@ -208,11 +208,9 @@ class Sync {if (this.uncachedAttachments.length > 0 && options.offlineMode) {await this.db.fs()- .queueDownloads(- this.uncachedAttachments,- "download-uncached-attachments",- { readOnDownload: false }- );+ .queueDownloads(this.uncachedAttachments, "offline-mode", {+ readOnDownload: false+ });this.uncachedAttachments = [];}}diff --git a/packages/core/src/collections/attachments.ts b/packages/core/src/collections/attachments.tsindex 9094431a4..2eef19330 100644--- a/packages/core/src/collections/attachments.ts+++ b/packages/core/src/collections/attachments.ts@@ -364,7 +364,7 @@ export class Attachments implements ICollection {filename: a.hash,chunkSize: a.chunkSize})),- "download-all-attachments",+ "offline-mode",{ readOnDownload: false });}