Browse Source

fix: bulk update mising record handling

pull/8315/head
mertmit 7 months ago
parent
commit
3a86f23c23
  1. 14
      packages/nocodb/src/db/BaseModelSqlv2.ts

14
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -3739,20 +3739,20 @@ class BaseModelSqlv2 {
if (oldRecords.length === tempToRead.length) { if (oldRecords.length === tempToRead.length) {
prevData.push(...oldRecords); prevData.push(...oldRecords);
} else { } else {
for (const record of oldRecords) { for (const recordPk of tempToRead) {
const pkValues = this._extractPksValues(record); const oldRecord = oldRecords.find(
(r) => this._extractPksValues(r) === recordPk,
const exists = tempToRead.find((d) => d === pkValues); );
if (!exists) { if (!oldRecord) {
// throw or skip if no record found // throw or skip if no record found
if (throwExceptionIfNotExist) { if (throwExceptionIfNotExist) {
NcError.recordNotFound(JSON.stringify(pkValues)); NcError.recordNotFound(JSON.stringify(recordPk));
} }
continue; continue;
} }
prevData.push(record); prevData.push(oldRecord);
} }
} }
} }

Loading…
Cancel
Save