benwinding / react-admin-import-csv

A csv file import button for react-admin

Home Page:https://benwinding.github.io/react-admin-import-csv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improvement: pass more params into `validateRow` for improved row validation

bayareacoder opened this issue · comments

commented

In file import-controller.ts, function CheckCSVValidation, change from:

await Promise.all(csvValues.map((v) => validateRow(v)));

to:

await Promise.all(csvValues.map(validateRow));

so user-provided validation function has access to row index to inform user which row is failing validation, and even the full array of records (3rd arg from array.map) to allow cross-record validation in a data set.

Hi @bayareacoder (Nice username btw),
Yeah I think that's probably a good idea, I'll implement now.
Cheers,
Ben