You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What you were expecting:
Setting the disableClearable prop on AutocompleteArrayInput should be possible without any build error. It removes the cross icon and removes the ability to clear the autocomplete input.
What happened instead:
Build error occurs stating Type 'true' is not assignable to type 'false'.
<ReferenceArrayInput{...props}perPage={5}filter={{ published }}><AutocompleteArrayInputcreate={<CreateTag/>}optionText={`name.${locale}`}disableClearable// ADD THIS PROP -> Type 'true' is not assignable to type 'false'/></ReferenceArrayInput>
Other information:
Setting the prop disableClearable does work on a regular AutocompleteInput component.
This can be checked by adding the disableClearable prop to AutocompleteInput in src/posts/PostEdit.tsx.
A workaround is to force any type as done below. However that shouldn't be needed. Simply setting disableClearable should work.
<ReferenceArrayInput{...props}perPage={5}filter={{ published }}><AutocompleteArrayInputcreate={<CreateTag/>}optionText={`name.${locale}`}disableClearable={trueasany}// ADD THIS PROP -> this workaround works/></ReferenceArrayInput>
Environment
React-admin version: 4.1.0
Last version that did not exhibit the issue (if applicable):
React version: 17
Browser: Chrome version 101.0.4951.67
The text was updated successfully, but these errors were encountered:
djhi
changed the title
Setting disableClearable prop on AutocompleteArrayInput gives build error
[TypeScript] Fix disableClearable prop on AutocompleteArrayInput
Jun 1, 2022
What you were expecting:
Setting the
disableClearable
prop onAutocompleteArrayInput
should be possible without any build error. It removes the cross icon and removes the ability to clear the autocomplete input.What happened instead:

Build error occurs stating Type 'true' is not assignable to type 'false'.
Steps to reproduce:
Use your
simple
application sandbox.https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple?file=/src/posts/TagReferenceInput.tsx
Update
src/posts/TagReferenceInput.tsx
by adding thedisableClearable
as shown below and see the compiler warning when hovering over the red squiggles.Other information:
Setting the prop
disableClearable
does work on a regularAutocompleteInput
component.This can be checked by adding the
disableClearable
prop toAutocompleteInput
insrc/posts/PostEdit.tsx
.A workaround is to force any type as done below. However that shouldn't be needed. Simply setting
disableClearable
should work.Environment
The text was updated successfully, but these errors were encountered: