This repository was archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
dataHandler is still called twiceΒ #109
Copy link
Copy link
Open
Description
Still have a problem like in this issue.
I have installed v0.8.1
When I try to send data to the database inside the dataHandler function, all my functions run twice, leading to incorrect results:
console log:

My code:
<Importer
dataHandler={async (rows) => {
console.log(
"π ~ file: AddFromCsvTab.tsx:88 ~ dataHandler={ ~ rows:",
rows
);
const data = await createList.mutateAsync({
orgId: curUser?.current_org_id!,
addedByUserId: curUser?.cur_user_id!,
listName: newListName!,
});
rows.forEach((row) => {
addContactToNewList.mutate({
addedByUserId: curUser?.user_id!,
orgId: curUser?.current_org_id!,
listId: data.listId,
...(row as CsvContactInfo),
});
});
}}
defaultNoHeader={false} // optional, keeps "data has headers" checkbox off by default
restartable={true} // optional, lets user choose to upload another file when import is complete
locale={enUS}
skipEmptyLines={true}
>
<ImporterField name="firstName" label="First Name" />
<ImporterField name="lastName" label="Last Name" />
<ImporterField name="email" label="Email" />
<ImporterField name="notes" label="Info" />
</Importer>
My CSV file: List.csv
Metadata
Metadata
Assignees
Labels
No labels