api-platform / admin

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

Vulcain support for reference fields/inputs #448

Open Jayfrown opened 2 years ago

Jayfrown commented 2 years ago

Description
Hey! I am currently using APIP with this admin package to build a UI on top of my API. Most of my resources have multiple many-to-one or many-to-many relationships, which end up on each screen (show, create, edit). I'm using the default <ReferenceField /> and <ReferenceInput /> to load these relationships, but these end up making quite a few additional API calls which slows down page render.

If I understood correctly, Vulcain could help combat this issue by hitting the API once, and passing an additional header specifying which additional resources to pass in the response. However, this doesn't seem possible with my set-up, as I'm not calling the dataProvider directly (it is done by the reference components) and cannot specify the header for Vulcain.

Or maybe I am missing something. Should I not be using the <ReferenceField />/<ReferenceInput /> in this case? Would it be possible to pass the Preload header if I use the dataProvider methods directly? (eg. useGetList, useGetOne, useGetMany etc)

Thanks.

alanpoulain commented 2 years ago

Vulcain support is not added (yet?) in API Platform Admin. PR welcome though!