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 possible to use a SimpleList as a child of an ArrayField #6975

Merged
merged 2 commits into from
Dec 15, 2021

Conversation

Luwangel
Copy link
Contributor

Description

The <ArrayField> builds a list context by passing null as total. The SimpleList expects a total > 0 to be rendered. Both are incompatible.

I studied two solutions:

  1. Compute the total using ids (chosen)
  2. Remove the total > 0 condition

To not introduce breaking changes, and because it's cleaner, I choose the first solution.

Related Issue

Fixing #6974

@Luwangel Luwangel added the RFR Ready For Review label Dec 10, 2021
@Luwangel Luwangel changed the title Pass the total of ids when building the list context of the ArrayField Make possible to use a SimpleList as a child of an ArrayField Dec 10, 2021
@djhi djhi added this to the 3.19.4 milestone Dec 14, 2021
Copy link
Collaborator

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for the ArrayField and SimpleList?

@vercel vercel bot temporarily deployed to Preview – react-admin December 15, 2021 14:21 Inactive
@vercel vercel bot temporarily deployed to Preview – react-admin-storybook December 15, 2021 14:21 Inactive
@fzaninotto
Copy link
Member

Why don't you use useList? It's the perfect use case for it.

https://github.com/marmelab/react-admin/blob/next/docs/useList.md

@Luwangel
Copy link
Contributor Author

Why don't you use useList? It's the perfect use case for it.

https://github.com/marmelab/react-admin/blob/next/docs/useList.md

The fix here is to make the ArrayField / SimpleList work together. But you're right, there are other ways to build this kind of feature.

@fzaninotto fzaninotto merged commit e51a6c6 into master Dec 15, 2021
@fzaninotto fzaninotto deleted the fix-array-field-total branch December 15, 2021 15:58
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.

4 participants