General concept of app: From the admin panel I want to be able to do CRUD operations on following entities: Slider and Banner. Banner can be added to many Sliders and can have different position on each. Due to that fact there is a third entity: BannerSlider that consists of banner_id, slider_id and position fields;
Code:
export const SliderEdit = props => (
<Edit {...props}>
<SimpleForm>
<NumberInput source="status" />
<ArrayInput source="bannerSliders">
<SimpleFormIterator>
<ReferenceInput label="Banner" source="banner.id" reference="banners">
<SelectInput optionText="name" />
</ReferenceInput>
<NumberInput source="position" />
</SimpleFormIterator>
</ArrayInput>
</SimpleForm>
</Edit>
);
Issue: When there are 5 banners assigned to given slider, there are 5 requests to backend, each from <ReferenceInput>
. Each request is the same request and have same parameters. Is there any way to call the backend only once? Or maybe there is something wrong with my code?
Also, as a side note - I think when user clicks "add" there shouldn't be additional request for the new ReferenceInput
, cause all the data is already there. But that's something to consider for the authors. ( Yeah, I know I may contribute too :P )
from Is there any cache in react-admin
No comments:
Post a Comment