We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What you were expecting:
When focusing then blurring an <AutocompleteArrayInput> with a create prop, the text I typed should be kept.
<AutocompleteArrayInput>
create
What happened instead:
The text is replaced by "undefined" instead.
Steps to reproduce:
const choices = [ { id: 'admin', name: 'Admin' }, { id: 'u001', name: 'Editor' }, { id: 'u002', name: 'Moderator' }, { id: 'u003', name: 'Reviewer' }, ]; export const CreateProp = () => ( <AdminContext i18nProvider={i18nProvider}> <Create resource="users" record={{ roles: ['u001', 'u003'] }} > <SimpleForm> <AutocompleteArrayInput source="roles" choices={choices} create={<CreateRole />} /> </SimpleForm> </Create> </AdminContext> ); // The create component doesn't matter, but here is one legitimate one const CreateRole = () => { const { onCancel, onCreate } = useCreateSuggestionContext(); const [value, setValue] = React.useState(''); const handleSubmit = event => { event.preventDefault(); const newOption = { id: value, name: value }; choices.push(newOption); setValue(''); onCreate(newOption); }; return ( <Dialog open onClose={onCancel}> <form onSubmit={handleSubmit}> <DialogContent> <TextField label="Role name" value={value} onChange={event => setValue(event.target.value)} autoFocus /> </DialogContent> <DialogActions> <Button type="submit">Save</Button> <Button onClick={onCancel}>Cancel</Button> </DialogActions> </form> </Dialog> ); };
Environment
The text was updated successfully, but these errors were encountered:
Fix AutocompleteArrayInput shows undefined on blur
bf1e44e
Closes #8329
fzaninotto
Successfully merging a pull request may close this issue.
What you were expecting:
When focusing then blurring an
<AutocompleteArrayInput>
with acreate
prop, the text I typed should be kept.What happened instead:
The text is replaced by "undefined" instead.
Enregistrement.de.l.ecran.2022-10-28.a.12.37.04.mov
Steps to reproduce:
Environment
The text was updated successfully, but these errors were encountered: