react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

AutocompleteInput with ReferenceInput calling getList() two times after select on sugestion list

Open hs-dev-web opened this issue 1 year ago • 1 comments

What you were expecting: Just calling getList() once with this query param filter: {"id":["13"]}

What happened instead: After select an item from sugestion list the component calling getList() two times, the first is with this query string parameter:

filter: {"id":["13"]}

and the second with this:

filter: {}
range: [0,4]
sort: ["products.name ASC"]

Steps to reproduce:

<ReferenceInput
    source="product_id"
    reference="products"
    perPage={5}
    sort={{ field: "products.name", order: "ASC" }}
  >
    <AutocompleteInput />
  </ReferenceInput>

Other information: This behaviour makes selected item (item number 13) get cleared again after being selected, because it's not present in the first 5 records (result data from second calling)

Environment

  • React-admin version: 4.16.15
  • Last version that did not exhibit the issue (if applicable):
  • React version: 18.2.0
  • Browser: chrome
  • Stack trace (in case of a JS error):

hs-dev-web avatar Apr 22 '24 08:04 hs-dev-web

Thanks for this report. Would you mind to provide a reproductible example using the React-admin Stackblitz template?

adguernier avatar Apr 22 '24 09:04 adguernier