From 215765819900b30a0d331dd8f5e5dee72f97477e Mon Sep 17 00:00:00 2001 From: morizon Date: Wed, 25 Dec 2024 08:42:07 +0800 Subject: [PATCH] fix: realm db --- packages/kit-bg/src/dbs/local/realm/RealmDBAgent.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/kit-bg/src/dbs/local/realm/RealmDBAgent.ts b/packages/kit-bg/src/dbs/local/realm/RealmDBAgent.ts index 56d4ba3015d..f7551674dac 100644 --- a/packages/kit-bg/src/dbs/local/realm/RealmDBAgent.ts +++ b/packages/kit-bg/src/dbs/local/realm/RealmDBAgent.ts @@ -10,7 +10,7 @@ import { LocalDbAgentBase } from '../LocalDbAgentBase'; import { realmDBSchemasMap } from './schemas'; -import type { RealmObjectBase } from './base/RealmObjectBase'; +import type Realm from 'realm'; import type { ELocalDBStoreNames } from '../localDBStoreNames'; import type { ILocalDBAgent, @@ -35,7 +35,7 @@ import type { ILocalDBWithTransactionTask, IRealmDBSchemaMap, } from '../types'; -import type Realm from 'realm'; +import type { RealmObjectBase } from './base/RealmObjectBase'; export class RealmDBAgent extends LocalDbAgentBase implements ILocalDBAgent { constructor(realm: Realm) { @@ -229,8 +229,13 @@ export class RealmDBAgent extends LocalDbAgentBase implements ILocalDBAgent { const pairs = await this.buildRecordPairsFromIds(params); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - await Promise.all(pairs.map(async (oldRecord) => updater(oldRecord[1]!))); + await Promise.all( + pairs.map(async (oldRecord) => { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const newRecord = await updater(oldRecord[1]!); + return newRecord; + }), + ); return Promise.resolve(undefined); }