marmelab / react-admin

A frontend Framework for single-page applications on top of REST/GraphQL APIs, using TypeScript, React and Material Design
http://marmelab.com/react-admin
MIT License
25.04k stars 5.27k forks source link

SimpleFormIterator with ReferenceInput and AutocompleteInput clears selected value on item selection #10333

Open StephanieIlievaa opened 3 weeks ago

StephanieIlievaa commented 3 weeks ago

When using SimpleFormIterator with ArrayInput, ReferenceInput, and AutocompleteInput in React Admin, selecting an item from the AutocompleteInput dropdown temporarily displays the selected item but then clears it unexpectedly. This issue makes it difficult to keep the selected value in the input field.

This issue appears to occur specifically within SimpleFormIterator, as ReferenceInput and AutocompleteInput work as expected outside of SimpleFormIterator.

Steps to Reproduce Create a form component using ArrayInput, SimpleFormIterator, ReferenceInput, and AutocompleteInput, similar to the following setup:

Frontend: Image

Expected Behavior The selected company should remain in the input field, allowing the user to see the chosen item until they either submit the form or make a new selection. Actual Behavior Upon selecting a company, the AutocompleteInput momentarily displays the selected company but then re-renders, clearing the selected value from the input field.

Environment React Admin version: "^4.16.12" React version: "^18.2.0" Browser: Chrome 130.0.6723.92 (Official Build)

djhi commented 2 weeks ago

Thanks for reporting this. Please provide a sample application showing the issue, preferably a sandbox forked from