File tree 3 files changed +15
-15
lines changed
ra-ui-materialui/src/list
3 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ const useQueryWithStore = <State extends ReduxState = ReduxState>(
158
158
data,
159
159
total,
160
160
loaded : true ,
161
+ loading : false ,
161
162
} ) ) ;
162
163
}
163
164
}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ const useStyles = makeStyles(
33
33
) ;
34
34
35
35
const Empty : FC < EmptyProps > = props => {
36
- const { basePath } = useListContext ( props ) ;
36
+ const { basePath, hasCreate } = useListContext ( props ) ;
37
37
const resource = useResourceContext ( props ) ;
38
38
const classes = useStyles ( props ) ;
39
39
const translate = useTranslate ( ) ;
@@ -61,15 +61,19 @@ const Empty: FC<EmptyProps> = props => {
61
61
_ : emptyMessage ,
62
62
} ) }
63
63
</ Typography >
64
- < Typography variant = "body1" >
65
- { translate ( `resources.${ resource } .invite` , {
66
- _ : inviteMessage ,
67
- } ) }
68
- </ Typography >
69
- </ div >
70
- < div className = { classes . toolbar } >
71
- < CreateButton variant = "contained" basePath = { basePath } />
64
+ { hasCreate && (
65
+ < Typography variant = "body1" >
66
+ { translate ( `resources.${ resource } .invite` , {
67
+ _ : inviteMessage ,
68
+ } ) }
69
+ </ Typography >
70
+ ) }
72
71
</ div >
72
+ { hasCreate && (
73
+ < div className = { classes . toolbar } >
74
+ < CreateButton variant = "contained" basePath = { basePath } />
75
+ </ div >
76
+ ) }
73
77
</ >
74
78
) ;
75
79
} ;
Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ export const ListView = (props: ListViewProps) => {
46
46
total,
47
47
loaded,
48
48
loading,
49
- hasCreate,
50
49
filterValues,
51
50
selectedIds,
52
51
} = listContext ;
@@ -88,11 +87,7 @@ export const ListView = (props: ListViewProps) => {
88
87
) ;
89
88
90
89
const shouldRenderEmptyPage =
91
- hasCreate &&
92
- loaded &&
93
- ! loading &&
94
- total === 0 &&
95
- ! Object . keys ( filterValues ) . length ;
90
+ loaded && ! loading && total === 0 && ! Object . keys ( filterValues ) . length ;
96
91
97
92
return (
98
93
< div
You can’t perform that action at this time.
0 commit comments