mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
core: prevent recursive sync after pushing items
This commit is contained in:
@@ -53,7 +53,8 @@ class Collector {
|
||||
|
||||
await collection.update(
|
||||
chunk.map((i) => i.id),
|
||||
{ synced: true }
|
||||
{ synced: true },
|
||||
{ sendEvent: false }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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[]> {
|
||||
|
||||
Reference in New Issue
Block a user