marmelab / ra-supabase

Supabase adapter for react-admin, the frontend framework for building admin applications on top of REST/GraphQL services.
MIT License
142 stars 26 forks source link

Add support for React-admin 4.x #21

Closed cedricjacobs closed 1 year ago

cedricjacobs commented 2 years ago

When installing this plugin with react-admin 4.0.1 the following errors occur in the console:

`ERROR in ../../node_modules/ra-supabase-ui-materialui/esm/AuthLayout.js 26:0-49 Module not found: Error: Can't resolve '@material-ui/core' in '/Users/cedricjacobs/Dev/camp-cooking/whats-cooking/node_modules/ra-supabase-ui-materialui/esm'

ERROR in ../../node_modules/ra-supabase-ui-materialui/esm/AuthLayout.js 27:0-67 Module not found: Error: Can't resolve '@material-ui/core/styles' in '/Users/cedricjacobs/Dev/camp-cooking/whats-cooking/node_modules/ra-supabase-ui-materialui/esm'

ERROR in ../../node_modules/ra-supabase-ui-materialui/esm/AuthLayout.js 28:0-52 Module not found: Error: Can't resolve '@material-ui/styles' in '/Users/cedricjacobs/Dev/camp-cooking/whats-cooking/node_modules/ra-supabase-ui-materialui/esm'

ERROR in ../../node_modules/ra-supabase-ui-materialui/esm/AuthLayout.js 29:0-47 Module not found: Error: Can't resolve '@material-ui/icons/Lock' in '/Users/cedricjacobs/Dev/camp-cooking/whats-cooking/node_modules/ra-supabase-ui-materialui/esm'

ERROR in ../../node_modules/ra-supabase-ui-materialui/esm/Input.js 24:0-46 Module not found: Error: Can't resolve '@material-ui/core' in '/Users/cedricjacobs/Dev/camp-cooking/whats-cooking/node_modules/ra-supabase-ui-materialui/esm'

ERROR in ../../node_modules/ra-supabase-ui-materialui/esm/LoginForm.js 3:0-47 Module not found: Error: Can't resolve 'react-final-form' in '/Users/cedricjacobs/Dev/camp-cooking/whats-cooking/node_modules/ra-supabase-ui-materialui/esm'

ERROR in ../../node_modules/ra-supabase-ui-materialui/esm/LoginForm.js 4:0-74 Module not found: Error: Can't resolve '@material-ui/core' in '/Users/cedricjacobs/Dev/camp-cooking/whats-cooking/node_modules/ra-supabase-ui-materialui/esm'

ERROR in ../../node_modules/ra-supabase-ui-materialui/esm/LoginForm.js 5:0-54 Module not found: Error: Can't resolve '@material-ui/core/styles' in '/Users/cedricjacobs/Dev/camp-cooking/whats-cooking/node_modules/ra-supabase-ui-materialui/esm'

ERROR in ../../node_modules/ra-supabase-ui-materialui/esm/SetPasswordForm.js 39:0-47 Module not found: Error: Can't resolve 'react-final-form' in '/Users/cedricjacobs/Dev/camp-cooking/whats-cooking/node_modules/ra-supabase-ui-materialui/esm'

ERROR in ../../node_modules/ra-supabase-ui-materialui/esm/SetPasswordForm.js 40:0-74 Module not found: Error: Can't resolve '@material-ui/core' in '/Users/cedricjacobs/Dev/camp-cooking/whats-cooking/node_modules/ra-supabase-ui-materialui/esm'

ERROR in ../../node_modules/ra-supabase-ui-materialui/esm/SetPasswordForm.js 41:0-54 Module not found: Error: Can't resolve '@material-ui/core/styles' in '/Users/cedricjacobs/Dev/camp-cooking/whats-cooking/node_modules/ra-supabase-ui-materialui/esm'`

I have used Nx to bootstrap the project with react 18

cedricjacobs commented 2 years ago

it seems that the major issue here is indeed the fact that material ui has so many underlying changes.

jean-smaug commented 2 years ago

They switched to the newer version of material-ui for React Admin 4. This is the cause of your errors.

If like me, you don't use auth and UI from supabase, you can copy paste the dataProvider in your project. https://github.com/marmelab/ra-supabase/blob/main/packages/ra-supabase-core/src/dataProvider.ts

And replace this import.

- import { DataProvider, GetListParams } from 'ra-core';
+ import { DataProvider, GetListParams } from "react-admin";

I don't think I needed to modify other stuff, but it was several weeks ago, so I'm not sure about that 😄

SimonApplaunch commented 2 years ago

Are there plans to update this package to work with React Admin 4 or has it reached end of life? I'm about to start a new project and don't want to use something that will make updating the code base in future more of a pain than it needs to be.

fzaninotto commented 2 years ago

For the data provider part, you can use ra-data-postgrest. For the auth part, there is not much in the library, but it actually needs an update.

If anyone is willing to help with this, feel free to open a PR!

SimonApplaunch commented 2 years ago

Ok thanks for the update, I don't have the knowledge in the 2 platforms yet to be of any use but I will look into the package code as a reference for what I need to do.

djhi commented 2 years ago

Note that for ra-data-postgrest to works, you must specify the following endpoint:

YOUR_SUPABASE_INSTANCE_URL/rest/v1

SimonApplaunch commented 2 years ago

Great, thanks for the heads up 😄

arnespremberg commented 2 years ago

Is anyone working on a PR yet? We'll need it for a project and are happy to contribute. Let's chat :)

fzaninotto commented 2 years ago

Nobody is working on a PR that I know of, so you're free to give it a spin!

arnespremberg commented 2 years ago

Hi @fzaninotto I think I've run most of the update, however I have a hard time setting up the correct dependency loading in order to everything before creating a PR. The monorepo is giving me a hard time...

Would you (or anyone else, for that matter) maybe find the time to give it a quick rest run from this repo: https://github.com/arnespremberg/ra-supabase

braco commented 1 year ago

Thanks @arnespremberg!

@fzaninotto it looks like ra-data-postgrest isn't working either?:

https://github.com/raphiniert-com/ra-data-postgrest/issues/31

promitheus7 commented 1 year ago

@braco I ended up forking and upgrading dependencies / implementing fixes for React Admin 4 myself - you can see the package details here

RWOverdijk commented 1 year ago

@promitheus7 Why not push it upstream?

arnespremberg commented 1 year ago

What's the current status on this? Anyone willing to have a chat on how to move this forward?

scheiblr commented 1 year ago

@promitheus7, I would be very happy, if you could just push the changes upstream, instead of highjacking the project. Then I would create a new major version. That's how OS works generally.

Kind regards

promitheus7 commented 1 year ago

Hey @scheiblr, happy to do so. I reached out about this in June in this issue but did not hear back, so I made necessary the changes + published it for myself. You can find the PR for my changes here.

promitheus7 commented 1 year ago

@promitheus7 Why not push it upstream?

@RWOverdijk I opened an issue 2 months ago but did not hear back. Was not sure if the OG author was still maintaining the package. PR available in the comment above.

RWOverdijk commented 1 year ago

@promitheus7 My bad, I thought the changes were for this repo, I didn't notice it was ra-data-postgrest

say8425 commented 1 year ago

ra-data-postgrest added RA 4.1.x compatibility #35 and it was released in 1.2.0. Now can we forward to something?

djhi commented 1 year ago

We released v2.0.0. It supports react-admin v4