api-platform / admin

A beautiful and fully-featured administration interface builder for hypermedia APIs
https://api-platform.com/docs/admin/
MIT License
481 stars 130 forks source link

Upgrade to v3.x.x - CRUD context props are gone #461

Closed kristijansoldo closed 2 years ago

kristijansoldo commented 2 years ago

API Platform version(s) affected: 3.3.0

Description
I have app in api-platform/admin and I'm using HydraAdmin to create complete admin interface which is connected to server side app written in api-platform as well.

For customizations and other stuff I have strictly followed guides and app is initially written in v2.8.0.

So I did the upgrade and app crashed as I expected then I did some fixes described in Marmelab's upgrade docs: and app started to works but I have no props that I used for CreateContextProvider and EditContextProvider to override save method.

How to reproduce
You need to just follow the docs to reproduce this.

  1. Step - Initialize api-platform/admin with latest version
  2. Set HydraAdmin and try to override some entity with ResourceGuesser eg. ListView https://api-platform.com/docs/admin/customizing/#customizing-the-list-view
  3. Console log props.
    
    const ReviewsList = props => {
    console.log('ReviewsList props', props); // Props in v3 are empty, but props in 2.8 not empty. 
    return (
      <ListGuesser {...props}>
        ...
      </ListGuesser>
    );
    }

Props are empty on all CRUD views.



**Possible Solution**  
I don't know what can be possible solution, but it might be some breaking change that you didn't notice. 

**Additional Context**  
v3.3.0: 
![v3](https://user-images.githubusercontent.com/15091958/180994078-69409be8-6795-450a-9c06-7f647e0bcf85.png)

v2.8.0:
![v2 8 0](https://user-images.githubusercontent.com/15091958/180994007-a94f8d92-31f1-4410-92a9-6249c99bac57.png)
alanpoulain commented 2 years ago

You can have more information in the Upgrade Guide of react-admin: https://marmelab.com/react-admin/Upgrade.html#no-more-prop-injection-in-page-components. You need to use hooks to get the flags from the contexts.