benwinding / react-admin-import-csv

A csv file import button for react-admin
https://benwinding.github.io/react-admin-import-csv
MIT License
135 stars 46 forks source link

react-admin 4.x upgrade #89

Closed fkowal closed 2 years ago

fkowal commented 2 years ago

PLS dont merge there is an issue with react hooks

everything else complies but I cant figure it out why I am getting

Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

BenStirrup commented 2 years ago

+1 for the compatibility with react-admin v4 ! 😇

emiliofonseca commented 2 years ago

+1 for the compatibility with react-admin v4 ! 😇

promitheus7 commented 2 years ago

+1 for the compatibility with react-admin v4 ! Will be investigating the error later today in hopes I can fix it - thank you for taking the initiative to make this upgrade @fkowal

KonkretneKosteczki commented 2 years ago

Simply removing the redux seems to be working just fine. Make sure to remove the @types/react-redux from dependencies, as well since it's been there even before you added it.

Also the app will not actually work with those changes, since resource is no longer passed via props. Within the src/main-csv-button.tsx replace the resource from props with resource from useResourceContext(). (Or update the readme on passing resource explicitly to the MainCsvImport)

After applying the before mentioned changes i no longer have any errors with the app and it seems to be working as intended.

I have added those changes in a fork to @fkowal repository https://github.com/fkowal/react-admin-import-csv/pull/1

fkowal commented 2 years ago

@KonkretneKosteczki Thank you for resolving this

i checked it and it's working

@benwinding pls have and look and hopefully we can't get a release soon

Thank all for participating

benwinding commented 2 years ago

Merged in! 🚀 Thanks for the effort 🙏 Try it via react-admin-import-csv@4.0.0 and let me know if there's any issues 👍