Search code examples
reactjsadmin-on-rest

admin on rest 2 filters with same source


I want to create two filters on the same resource and the same source with referenceInputs but for different queries, like this :

<Filter>    
    <ReferenceInput  source="productCode" reference="product" filterToQuery=
 {searchText => ({ name: searchText+'*' })}>
        <AutocompleteInput optionText="name" allowEmpty/>
    </ReferenceInput>,  
    <ReferenceInput source="productCode" 
    label='resources.product.fields.code' reference="product" filterToQuery={searchText => ({ code: searchText+'*' })}>
        <AutocompleteInput optionText="code" allowEmpty  />
    </ReferenceInput>
</Filter>

But I get an error : proxyConsole.js:56 Warning: flattenChildren(...): Encountered two children with the same key, .$productCode. Child keys must be unique;

and the second filter is not rendered.

I tried to add distinct "key" parameters on referenceInputs and/or AutoCompleInputs but I still have the error.

Can I use any work around ?


Solution

  • This scenario is not supported currently. Please open an issue in the admin-on-rest repository.