From e9447cdcfe0258ae39a9219294f6753793cdf5a1 Mon Sep 17 00:00:00 2001 From: DarkSky Date: Thu, 11 Aug 2022 10:44:22 +0800 Subject: [PATCH] fix: load data on first time --- libs/datasource/jwt-rpc/src/sqlite.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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,