Skip to content

Commit 9fc0050

Browse files
authored
Fix for empty user default tab after creation (#628)
1 parent dbcb4f9 commit 9fc0050

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/resources/users.tsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import {
4747
TopToolbar,
4848
NumberField,
4949
useListContext,
50+
Identifier,
5051
} from "react-admin";
5152
import { Link } from "react-router-dom";
5253

@@ -112,7 +113,10 @@ export const UserList = (props: ListProps) => (
112113
actions={<UserListActions />}
113114
pagination={<UserPagination />}
114115
>
115-
<Datagrid rowClick="edit" bulkActionButtons={<UserBulkActionButtons />}>
116+
<Datagrid
117+
rowClick={(id: Identifier, resource: string) => `/${resource}/${id}`}
118+
bulkActionButtons={<UserBulkActionButtons />}
119+
>
116120
<AvatarField source="avatar_src" sx={{ height: "40px", width: "40px" }} sortBy="avatar_url" />
117121
<TextField source="id" sortBy="name" />
118122
<TextField source="displayname" />
@@ -153,7 +157,12 @@ const UserEditActions = () => {
153157
};
154158

155159
export const UserCreate = (props: CreateProps) => (
156-
<Create {...props}>
160+
<Create
161+
{...props}
162+
redirect={(resource: string | undefined, id: Identifier | undefined) => {
163+
return `${resource}/${id}`;
164+
}}
165+
>
157166
<SimpleForm>
158167
<TextInput source="id" autoComplete="off" validate={validateUser} />
159168
<TextInput source="displayname" validate={maxLength(256)} />

0 commit comments

Comments
 (0)