Skip to content

Commit cf54adb

Browse files
committed
Fix side effects and warnings in simple example
1 parent 3acf58d commit cf54adb

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

examples/simple/src/users/UserCreate.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const UserEditToolbar = ({ permissions, ...props }) => {
2929
notify('ra.notification.created', 'info', {
3030
smart_count: 1,
3131
});
32-
redirect('show', data.id, data);
32+
redirect('show', '/users', data.id);
3333
},
3434
}}
3535
submitOnEnter={true}
@@ -64,7 +64,10 @@ const UserCreate = () => {
6464
const { permissions } = usePermissions();
6565
return (
6666
<Create aside={<Aside />}>
67-
<TabbedForm toolbar={<UserEditToolbar permissions={permissions} />}>
67+
<TabbedForm
68+
warnWhenUnsavedChanges
69+
toolbar={<UserEditToolbar permissions={permissions} />}
70+
>
6871
<FormTab label="user.form.summary" path="">
6972
<TextInput
7073
source="name"

examples/simple/src/users/UserShow.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint react/jsx-key: off */
22
import * as React from 'react';
3-
import PropTypes from 'prop-types';
43
import {
54
Show,
65
Tab,
@@ -32,10 +31,4 @@ const UserShow = () => {
3231
);
3332
};
3433

35-
UserShow.propTypes = {
36-
location: PropTypes.object.isRequired,
37-
match: PropTypes.object.isRequired,
38-
permissions: PropTypes.string,
39-
};
40-
4134
export default UserShow;

0 commit comments

Comments
 (0)