Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make List children responsible of the empty state #8585

Merged
merged 3 commits into from
Feb 10, 2023

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Jan 17, 2023

Problem

Currently the <List> component is responsible for displaying something when there is no data. However, we introduced the empty prop on the <Datagrid> component as well. When passing empty={false} to the <List>, it displays its child and the empty provided to the <Datagrid> is then used.

However, the <Pagination> component also displays something special when there is no data, which is not desirable in this case.

Solution

Make handling empty state the responsibility of the <List> child when the <List> doesn't. Both the <Datagrid> and the <SimpleList> now accept an empty prop. This prop accepts either an element or false.

Besides, we deprecated the limit prop on the <Pagination> component. It now renders null when there is no data.

docs/Datagrid.md Outdated Show resolved Hide resolved
docs/SimpleList.md Outdated Show resolved Hide resolved
packages/ra-ui-materialui/src/list/ListNoResults.tsx Outdated Show resolved Hide resolved
packages/ra-ui-materialui/src/list/datagrid/Datagrid.tsx Outdated Show resolved Hide resolved
@slax57 slax57 merged commit e76e3eb into next Feb 10, 2023
@slax57 slax57 deleted the deprecate-pagination-limit branch February 10, 2023 14:58
@slax57 slax57 added this to the 4.8.0 milestone Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants