Skip to content

Commit

Permalink
Merge pull request #6139 from marmelab/fix-radio-button-group-input-w…
Browse files Browse the repository at this point in the history
…arnings

Fix RadioButtonGroupInput Warnings
  • Loading branch information
fzaninotto authored Apr 9, 2021
2 parents 34dfc0c + 2302bb4 commit e045b98
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const RadioButtonGroupInput: FunctionComponent<RadioButtonGroupInputProps> = pro
component="fieldset"
margin={margin}
error={touched && !!(error || submitError)}
{...sanitizeInputRestProps(rest)}
{...sanitizeRestProps(rest)}
>
<FormLabel component="legend" className={classes.label}>
<FieldTitle
Expand Down Expand Up @@ -195,7 +195,7 @@ const RadioButtonGroupInput: FunctionComponent<RadioButtonGroupInputProps> = pro
};

RadioButtonGroupInput.propTypes = {
choices: PropTypes.arrayOf(PropTypes.any).isRequired,
choices: PropTypes.arrayOf(PropTypes.any),
label: PropTypes.string,
options: PropTypes.object,
optionText: PropTypes.oneOfType([
Expand All @@ -217,6 +217,40 @@ RadioButtonGroupInput.defaultProps = {
translateChoice: true,
};

const sanitizeRestProps = ({
addLabel,
afterSubmit,
allowNull,
beforeSubmit,
choices,
className,
crudGetMatching,
crudGetOne,
data,
filter,
filterToQuery,
formatOnBlur,
isEqual,
limitChoicesToValue,
multiple,
name,
pagination,
perPage,
ref,
reference,
render,
setFilter,
setPagination,
setSort,
sort,
subscription,
type,
validateFields,
validation,
value,
...rest
}: any) => sanitizeInputRestProps(rest);

export type RadioButtonGroupInputProps = ChoicesInputProps<RadioGroupProps> &
FormControlProps;

Expand Down

0 comments on commit e045b98

Please sign in to comment.