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: prevent recursive sync after pushing items
Abdullah Attae6642ac9abbd
diff --git a/packages/core/src/api/sync/collector.ts b/packages/core/src/api/sync/collector.tsindex 97ab5b533..28af685a5 100644--- a/packages/core/src/api/sync/collector.ts+++ b/packages/core/src/api/sync/collector.ts@@ -53,7 +53,8 @@ class Collector {await collection.update(chunk.map((i) => i.id),- { synced: true }+ { synced: true },+ { sendEvent: false });}}diff --git a/packages/core/src/database/sql-collection.ts b/packages/core/src/database/sql-collection.tsindex 778aa99c7..490e30b89 100644--- a/packages/core/src/database/sql-collection.ts+++ b/packages/core/src/database/sql-collection.ts@@ -166,7 +166,11 @@ export class SQLCollection<});}- async update(ids: string[], partial: Partial<SQLiteItem<T>>) {+ async update(+ ids: string[],+ partial: Partial<SQLiteItem<T>>,+ options: { sendEvent: boolean } = { sendEvent: true }+ ) {await this.db().updateTable<keyof DatabaseSchema>(this.type).where("id", "in", ids)@@ -176,7 +180,9 @@ export class SQLCollection<synced: partial.synced || false}).execute();- this.eventManager.publish(EVENTS.databaseUpdated, ids);+ if (options.sendEvent) {+ this.eventManager.publish(EVENTS.databaseUpdated, ids);+ }}async ids(sortOptions: GroupOptions): Promise<string[]> {