Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

dataHandler is still called twiceΒ #109

@nateswork1818

Description

@nateswork1818

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:
image

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions