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
core: fix duplicate colors created during backup restore
Abdullah Atta70818c24cde6
diff --git a/packages/core/src/database/backup.ts b/packages/core/src/database/backup.tsindex 013a61a76..886e7e410 100644--- a/packages/core/src/database/backup.ts+++ b/packages/core/src/database/backup.ts@@ -430,7 +430,6 @@ export default class Backup {}private async migrateData(data: BackupDataItem[], version: number) {- const queue: Partial<Record<CollectionName, MaybeDeletedItem<Item>[]>> = {};for (let item of data) {// we do not want to restore deleted itemsif (@@ -522,21 +521,16 @@ export default class Backup {const collectionKey: CollectionName = itemTypeToCollectionKey[itemType];if (!collectionKey) continue;- queue[collectionKey] = queue[collectionKey] || [];- queue[collectionKey]?.push(item);- }-- for (const key in queue) {- const collectionKey = key as CollectionName;const collection =collectionKey === "sessioncontent"? this.db.noteHistory.sessionContent.collection: this.db[collectionKey].collection;- if (!collection) continue;- const items = queue[collectionKey];- if (!items) continue;- await collection.put(items as any[]);+ // items should sync immediately after getting restored+ item.dateModified = Date.now();+ item.synced = false;++ await collection.upsert(item as any);}}