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

preCommitCallback is incorrectly called with a first argument of `create` for an update

bayareacoder opened this issue · comments

commented

In file uploader.ts, the preCommitCallback is incorrectly called with a first argument of create for an update, while it should be overwrite per the type definition

file uploader.ts:

export async function update(
  logging: boolean,
  dataProvider: DataProvider,
  resource: string,
  values: any[],
  preCommitCallback: PrecommitCallback,
  postCommitCallback: ErrorCallback,
) {
  const parsedValues = preCommitCallback ? await preCommitCallback('create', values) : values;

file config.interface.ts:

export type PrecommitCallback = (action: 'create' | 'overwrite', values: any[]) => Promise<any[]>;

Thanks again @bayareacoder,
Feel free to submit a Pull Request for future issues if you'd like!
Cheers,
Ben