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

Fix <SimpleList> always returns empty when controlled #9802

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Apr 29, 2024

<SimpleList data={data}> always renders an empty list regardless of the data.

Test the ra-ui-material-ui/list/simplelist/basic story to see the bug.

Cause

Even when the data prop is set, this condition forces the rendering of the empty component because total is also undefined.

if (data == null || total == null || data.length === 0 || total === 0) {
if (empty) {
return empty;
}
return null;
}

The condition is different in <Datagrid>:

if (data == null || data.length === 0 || total === 0) {
if (empty) {
return empty;
}
return null;
}

Solution

Remove the test on total in <SimpleList> empty clause

Test the ra-ui-material-ui/list/simplelist/basic story to see the bug.
@djhi djhi added this to the 5.0.0 milestone Apr 30, 2024
@djhi djhi merged commit a5f7d93 into next Apr 30, 2024
12 checks passed
@djhi djhi deleted the fix-simplelist-controlled branch April 30, 2024 07:26
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.

3 participants