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 ignored due to hooks setting values asynchronously

Mattia-Longhin opened this issue · comments

Hello,

First of all, thank you for your work!

I think that there is an issue with preCommitCallback. You call setValues with the result of preCommitCallback and then you use the content of values variable directly.

This does not work because you cannot trust setValues to synchronously change values. Your are providing the old values to the create function.

if (preCommitCallback) setValues(preCommitCallback('create', values));

Thanks for reporting and fixing the issue!
Closed by #26