diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts index f38bb0cb2e..40c266c117 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts @@ -1975,6 +1975,7 @@ class BaseModelSqlv2 { // await this.beforeUpdateb(updateDatas, transaction); const prevData = []; const newData = []; + const updatePkValues = []; const res = []; for (const d of updateDatas) { await this.validate(d); @@ -1987,11 +1988,16 @@ class BaseModelSqlv2 { const wherePk = await this._wherePk(pkValues); await transaction(this.tnPath).update(d).where(wherePk); res.push(wherePk); + updatePkValues.push(pkValues); + } + + transaction.commit(); + + for (const pkValues of updatePkValues) { newData.push(await this.readByPk(pkValues)); } await this.afterBulkUpdate(prevData, newData, this.dbDriver, cookie); - transaction.commit(); return res; } catch (e) {