diff --git a/packages/importer/src/columns.ts b/packages/importer/src/columns.ts index c851fc6df..4dc03371b 100644 --- a/packages/importer/src/columns.ts +++ b/packages/importer/src/columns.ts @@ -240,25 +240,12 @@ export const coerceRows = async >( columns: Schemas.Column[], options?: ColumnOptions ): Promise[]> => { - const columnValues = []; - for (const row of rows) { - for (const column of columns) { - columnValues.push(coerceValue(row[column.name], column, options)); - } - } - const results = await Promise.allSettled(columnValues); const mapped = []; - let index = 0; - for (const _row of rows) { - const mappedRow: Record = {}; - for (const column of columns) { - const result = results[index]; - if (result.status === 'fulfilled') { - mappedRow[column.name] = result.value; - } - index = index + 1; - } - mapped.push(mappedRow); + for (const row of rows) { + const entries = await Promise.all( + columns.map((column) => coerceValue(row[column.name], column, options).then((value) => [column.name, value])) + ); + mapped.push(Object.fromEntries(entries)); } return mapped; };