How to parse and format data with ReferenceArrayInput and AutocompleteArrayInput

Viewed 92

I work around react-admin 4.13. I have a problem transforming some data with parse and format when I use it to parse it also changes properties in fetch request and the error occurred.

<ReferenceArrayInput
  source="locations"
  reference="locations"
  filter={{ type: LOCATION_TYPE.SITE }}
>
  <AutocompleteArrayInput
    optionText="name"
    format={(list: Array<{ id: string }> = []) => list.map((i) => i.id)}
    parse={(list: Array<string> = []) => list.map((id) => ({ id }))}
  />
</ReferenceArrayInput>

request payload error field

0 Answers
Related