Skip to content

Commit

Permalink
Merge pull request #8915 from marmelab/fix-form-prop-sanitation-reset…
Browse files Browse the repository at this point in the history
…Options

Fix `SimpleForm` and `TabbedForm` do not sanitize the `resetOptions` prop
  • Loading branch information
djhi authored May 16, 2023
2 parents 495986a + b6b91e2 commit a2d9e85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/ra-ui-materialui/src/form/SimpleForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const DefaultComponent = styled(CardContent, {

const DefaultToolbar = <Toolbar />;

/* eslint-disable @typescript-eslint/no-unused-vars */
const sanitizeRestProps = ({
children,
className,
Expand All @@ -105,6 +106,7 @@ const sanitizeRestProps = ({
sx,
toolbar,
validate,
resetOptions,
resolver,
sanitizeEmptyValues,
shouldFocusError,
Expand All @@ -113,3 +115,4 @@ const sanitizeRestProps = ({
warnWhenUnsavedChanges,
...props
}: SimpleFormProps) => props;
/* eslint-enable @typescript-eslint/no-unused-vars */
3 changes: 3 additions & 0 deletions packages/ra-ui-materialui/src/form/TabbedForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const TabbedForm = (props: TabbedFormProps) => {

TabbedForm.Tab = FormTab;

/* eslint-disable @typescript-eslint/no-unused-vars */
const sanitizeRestProps = ({
criteriaMode,
defaultValues,
Expand All @@ -99,6 +100,7 @@ const sanitizeRestProps = ({
noValidate,
onSubmit,
record,
resetOptions,
resolver,
reValidateMode,
sanitizeEmptyValues,
Expand All @@ -109,6 +111,7 @@ const sanitizeRestProps = ({
warnWhenUnsavedChanges,
...rest
}: TabbedFormProps) => rest;
/* eslint-enable @typescript-eslint/no-unused-vars */

TabbedForm.propTypes = {
children: PropTypes.node,
Expand Down

0 comments on commit a2d9e85

Please sign in to comment.