I have looked around for many hours and tried various things but alot of the examples i see for CheckBoxGroupInput simply have a hardcoded list of choices associated which is a bit useless... My scenario here is that i have a list of tags that i want to be able to associate with a product, pretty common stuff..
i need that list to be fetched from the postgres database... and that part all seems to work and my list looks normal when first rendered on the create screens for react-admin... The control looks like below
<ReferenceInput reference="ProductRealBenefit" source="realbenefits" sort={{ field: 'name', order: 'ASC' }}>
<CheckboxGroupInput source="name" />
</ReferenceInput>
This all well and good so far..
it renders my list as expected.. i have my schema all set up according to the format for ra_data_graphql_simple... Thing that is unexpected, is that as soon as i click on one of the tags, it immediately sends off a request to the server for the allProductRealBenefit query with a filter value equal to the clicked id and it adds a duplicate of that clicked tag to the list which breaks the control with a duplicate key error... i don't see why it would be sending off a request after i click anyway, i am not trying to save anything just assemble which tags would be sent off with the form data to create the link records, and i already have all that data after the initial populating of the control..
i am guessing maybe this should not be nested in ReferenceInput but i don't see any other way to populate my choices with database query result. I know this is ridiculously common functionality & I'll need to figure out a way to use this in multiple spots because this tagging functionality should be available in multiple resources.. I also tried this with AutocompleteArrayInput and it had similar issues so i know the problem is i must be missing an important step.... Be great if someone can point be in the right direction. i am going back to the docs for now to see what i can dig up!