Closed magnattic closed 2 years ago
Reproduced ! Thanks for reporting, you've done most of the job - would you submit a pull request?
Yes, will provide a PR.
@septentrion-730n PR is open, let me know if there is something missing.
Fixed by 396a1b1e380fe4d0f9c932a2dc9796099db33839
What you were expecting: No console errors when using
<TabbedForm warnWhenUnsavedChanges>
.What happened instead: The following console error appears:
Steps to reproduce: Use the following code somewhere and open the tab:
Related code: I don't even have to fork the default codesandbox, just open the Posts Edit view in the simple ra example to see the error:
Other information: The issue is that TabbedForm passes the prop to the styled div, where it is not valid: https://github.com/marmelab/react-admin/blob/d8737f2234eddd6424419ed7e8a816558b8f9e54/packages/ra-ui-materialui/src/form/TabbedFormView.tsx#L62-L64 A solution could be to extend the sanitizeRestProps function to exclude warnWhenUnsavedChanges: https://github.com/marmelab/react-admin/blob/d8737f2234eddd6424419ed7e8a816558b8f9e54/packages/ra-ui-materialui/src/form/TabbedFormView.tsx#L152
Environment