Skip to content

Commit

Permalink
Merge pull request #2818 from marmelab/fix-clone-warning
Browse files Browse the repository at this point in the history
[RFR] Fix warning in CloneButton when used inside Toolbar
  • Loading branch information
Gildas Garcia authored Jan 28, 2019
2 parents 8550df8 + 74bab02 commit b7a5bb9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/ra-ui-materialui/src/button/CloneButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ import Button from './Button';

const omitId = ({ id, ...rest }) => rest;

const sanitizeRestProps = ({
// the next 6 props are injected by Toolbar
handleSubmit,
handleSubmitWithRedirect,
invalid,
pristine,
saving,
submitOnEnter,
...rest
}) => rest;

export const CloneButton = ({
basePath = '',
label = 'ra.action.clone',
Expand All @@ -22,7 +33,7 @@ export const CloneButton = ({
state: { record: omitId(record) },
}}
label={label}
{...rest}
{...sanitizeRestProps(rest)}
>
{icon}
</Button>
Expand Down

0 comments on commit b7a5bb9

Please sign in to comment.