diff --git a/packages/ra-core/src/dataProvider/useQueryWithStore.ts b/packages/ra-core/src/dataProvider/useQueryWithStore.ts index 109c9e4654e..0ef65e71952 100644 --- a/packages/ra-core/src/dataProvider/useQueryWithStore.ts +++ b/packages/ra-core/src/dataProvider/useQueryWithStore.ts @@ -158,6 +158,7 @@ const useQueryWithStore = ( data, total, loaded: true, + loading: false, })); } } diff --git a/packages/ra-ui-materialui/src/list/Empty.tsx b/packages/ra-ui-materialui/src/list/Empty.tsx index 9d13594efac..91f901290fd 100644 --- a/packages/ra-ui-materialui/src/list/Empty.tsx +++ b/packages/ra-ui-materialui/src/list/Empty.tsx @@ -33,7 +33,7 @@ const useStyles = makeStyles( ); const Empty: FC = props => { - const { basePath } = useListContext(props); + const { basePath, hasCreate } = useListContext(props); const resource = useResourceContext(props); const classes = useStyles(props); const translate = useTranslate(); @@ -61,15 +61,19 @@ const Empty: FC = props => { _: emptyMessage, })} - - {translate(`resources.${resource}.invite`, { - _: inviteMessage, - })} - - -
- + {hasCreate && ( + + {translate(`resources.${resource}.invite`, { + _: inviteMessage, + })} + + )}
+ {hasCreate && ( +
+ +
+ )} ); }; diff --git a/packages/ra-ui-materialui/src/list/ListView.tsx b/packages/ra-ui-materialui/src/list/ListView.tsx index c70baa6ac98..6a7baa503ee 100644 --- a/packages/ra-ui-materialui/src/list/ListView.tsx +++ b/packages/ra-ui-materialui/src/list/ListView.tsx @@ -46,7 +46,6 @@ export const ListView = (props: ListViewProps) => { total, loaded, loading, - hasCreate, filterValues, selectedIds, } = listContext; @@ -88,11 +87,7 @@ export const ListView = (props: ListViewProps) => { ); const shouldRenderEmptyPage = - hasCreate && - loaded && - !loading && - total === 0 && - !Object.keys(filterValues).length; + loaded && !loading && total === 0 && !Object.keys(filterValues).length; return (