diff --git a/libs/datasource/jwt-rpc/src/sqlite.ts b/libs/datasource/jwt-rpc/src/sqlite.ts index 3a33daa755..1753edda8b 100644 --- a/libs/datasource/jwt-rpc/src/sqlite.ts +++ b/libs/datasource/jwt-rpc/src/sqlite.ts @@ -163,8 +163,8 @@ export class SQLiteProvider extends Observable { } } - private _waitUpdate(sync = false) { - if (sync) { + private _waitUpdate(updates: any[], sync = false) { + if (updates.length && sync) { return new Promise((resolve, reject) => { const final = (_: any, origin: any) => { if (origin === this) { @@ -180,8 +180,8 @@ export class SQLiteProvider extends Observable { private async _fetchUpdates(sync = false) { if (this.db) { - const wait = this._waitUpdate(sync); const updates = getAllUpdates(this.db, this._ref); + const wait = this._waitUpdate(updates, sync); Y.transact( this.doc,