Skip to content

Commit

Permalink
Simplify component
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi committed Aug 22, 2019
1 parent a73b0d7 commit d735cc4
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/ra-ui-materialui/src/input/SelectArrayInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,6 @@ const SelectArrayInput = ({
...rest,
});

const handleChange = useCallback(
event => {
input.onChange(event.target.value);
// HACK: For some reason, redux-form does not consider this input touched without calling onBlur manually
input.onBlur(event.target.value);
},
[input]
);

const renderMenuItemOption = useCallback(
choice => {
if (React.isValidElement(optionText)) {
Expand Down Expand Up @@ -221,7 +212,6 @@ const SelectArrayInput = ({
autoWidth
multiple
input={<Input id={id} />}
value={input.value || []}
error={!!(touched && error)}
renderValue={selected => (
<div className={classes.chips}>
Expand All @@ -241,8 +231,9 @@ const SelectArrayInput = ({
</div>
)}
data-testid="selectArray"
{...input}
value={input.value || []}
{...options}
onChange={handleChange}
>
{choices.map(renderMenuItem)}
</Select>
Expand Down

0 comments on commit d735cc4

Please sign in to comment.