feat:expose renderInput in AutoCompleteInput props#11132
feat:expose renderInput in AutoCompleteInput props#11132AarishMansur wants to merge 1 commit intomarmelab:nextfrom
Conversation
|
I notice that the props already extend MUI's AutocompleteProps, specifically omitting renderInput. I wonder why this is, and I also wonder if a better fix wouldn't be of removing this prop from the omit array. |
|
No wait, I know: we don't want to support overriding the renderInput prop, as this is the heart of react-admin's AutocompleteInput. If you need a specific renderInput, I believe you should build your own AutocompleteInput. Can you expain your use case to determine if it's something we want to support? |
|
@fzaninotto It's to support the use-case described in #10430 @AarishMansur please mention the issue you are addressing when opening a PR, it helps with traceability. |
|
This PR is meant to support the use case described in #10430, where grouping is required and the selected option needs a richer visual representation. |
|
Understood, thanks for the feedback. I still think the correct implementation should be to remove the |
Problem
AutocompleteInputsupports therenderInputprop at runtime via the underlying MUI Autocomplete component, but this prop is not exposed in the TypeScript definition ofAutocompleteInputPropsAs a result, TypeScript users cannot pass
renderInputwithout losing type safety or relying on implicit typing.Closes #10430
Solution
This PR exposes the renderInput prop in the
AutocompleteInputTypeScript interface by reusing the corresponding type from MUI’sAutocompletePropsThere is no runtime behavior change this only aligns the TypeScript definition with the existing supported API.
How To Test
Use
AutocompleteInputwith arenderInputprop in a TypeScript project.Verify that TypeScript does not report any type errors.
Run the test suite (
yarn test) to ensure no regressions are introduced.Additional Checks
masterfor a bugfix or a documentation fix, ornextfor a featureAlso, please make sure to read the contributing guidelines.