question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi @benwinding

I just made some PRs in order to resolve some issues I had in the last weeks. I hope you’ll like the improvements.

I have some other suggestions that can be discussed here if you want.

Suggestions

https://github.com/benwinding/react-admin-import-csv/blob/84fdf2fd800c1471be73d05246febca0bfeb6f44/src/import-csv-button.tsx#L16

I suppose that all console.log should be forbidden, right?

https://github.com/benwinding/react-admin-import-csv/blob/84fdf2fd800c1471be73d05246febca0bfeb6f44/src/import-csv-button.tsx#L18

I used to dispatch an action crudUpdateMany in order to save that in the redux store and then it will trigger an UPDATE_MANY event to the according data provider. You, otherwise, you use directly the data provider for each item. I am not sure what is the best use of this ATM. Otherwise, I can see there is 2 kind of operations:

  • UPDATE if the primary key does not exist in the list
  • CREATE if the primary key already exist

It can be a little tricky but I believe we should allow the developer to choose the action to execute in those cases, don’t you think? Like adding a new prop.

https://github.com/benwinding/react-admin-import-csv/blob/84fdf2fd800c1471be73d05246febca0bfeb6f44/src/csv-extractor.ts#L14

Also, we manage papaparse props ourselves. That could be interesting to set default props and then let the developers override the props based on their own needs. Maybe by reusing the same standard of react-admin. They use an exporter prop, we could have an importer prop.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Odonnocommented, Mar 30, 2020

That’s a clever idea. react-admin already use Confirm modal to check for validation (like deletion). We should investigate on this to reuse their component.

Also, your idea gave some idea about new properties: overwrite and confirm. The confirm is a boolean to indicate if the modal should be opened. If confirm=false and overwrite is set, we should bypass the modal process to automatically execute the update/create.

That could be really good. The last thing that we should handle is when a user wants to import both new and updated data… Not sure how we can do that, because we cannot predict what user will put in the csv file.

0reactions
benwindingcommented, Apr 14, 2020

Hey @Odonno,

I’ve made some recent updates and included a demo here. Let me know what you think.

If you’d like to add some additional features or fix something, please have a look at the development notes at the bottom of the README, and submit a PR.

Cheers for your help, Ben

Read more comments on GitHub >

github_iconTop Results From Across the Web

some suggestions or some suggestion? - TextRanch
some suggestions is the most popular phrase on the web. More popular! some suggestions. 1,490,000,000 results on the web. Some examples from the...
Read more >
give some suggestions | English examples in context - Ludwig
High quality example sentences with “give some suggestions” in context from reliable sources - Ludwig is the linguistic search engine that helps you...
Read more >
Could you please give some suggestions / Could you give me ...
I don't believe I would ever hear a native English speaker say, "Please, can you give me some information." ( But then, never...
Read more >
Some suggestions for measuring predictive ... - PubMed
The performance of a prediction or measurement model is often evaluated by computing the correlation coefficient and/or the regression of predictions on ...
Read more >
SOME SUGGESTIONS ABOUT STORYTELLING
SOME SUGGESTIONS ABOUT STORYTELLING. • Either “big stories” (really important experiences in our lives) or “little stories” (a casual encounter, observation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found