ra-supabase icon indicating copy to clipboard operation
ra-supabase copied to clipboard

Add support for React-admin 4.x

Open cedricjacobs opened this issue 3 years ago • 19 comments

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 avatar Apr 19 '22 06:04 cedricjacobs

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

cedricjacobs avatar Apr 19 '22 10:04 cedricjacobs

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 😄

jean-smaug avatar Apr 23 '22 14:04 jean-smaug

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.

SimonApplaunch avatar Jun 07 '22 10:06 SimonApplaunch

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!

fzaninotto avatar Jun 08 '22 16:06 fzaninotto

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.

SimonApplaunch avatar Jun 09 '22 10:06 SimonApplaunch

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

YOUR_SUPABASE_INSTANCE_URL/rest/v1

djhi avatar Jun 09 '22 10:06 djhi

Great, thanks for the heads up 😄

SimonApplaunch avatar Jun 10 '22 10:06 SimonApplaunch

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

arnespremberg avatar Jun 14 '22 15:06 arnespremberg

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

fzaninotto avatar Jun 15 '22 07:06 fzaninotto

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

arnespremberg avatar Jul 06 '22 12:07 arnespremberg

Thanks @arnespremberg!

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

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

braco avatar Jul 13 '22 16:07 braco

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

promitheus7 avatar Aug 02 '22 10:08 promitheus7

@promitheus7 Why not push it upstream?

RWOverdijk avatar Aug 04 '22 14:08 RWOverdijk

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

arnespremberg avatar Aug 16 '22 14:08 arnespremberg

@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

scheiblr avatar Aug 18 '22 23:08 scheiblr

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 avatar Aug 19 '22 06:08 promitheus7

@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.

promitheus7 avatar Aug 19 '22 06:08 promitheus7

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

RWOverdijk avatar Aug 19 '22 07:08 RWOverdijk

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

say8425 avatar Sep 09 '22 14:09 say8425

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

djhi avatar Mar 06 '23 10:03 djhi