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

Cannot use a SimpleList as a child of an ArrayField #6974

Closed
Luwangel opened this issue Dec 10, 2021 · 1 comment
Closed

Cannot use a SimpleList as a child of an ArrayField #6974

Luwangel opened this issue Dec 10, 2021 · 1 comment
Labels

Comments

@Luwangel
Copy link
Contributor

What you were expecting:

I want to use a <SimpleList> inside an <ArrayField>, but it's not working.

const UserShow = ({ permissions, ...props }) => (
  <Show {...props}>
        <TextField source="id" />
        <TextField source="name" />
        <ArrayField source="skills">
          <SimpleList primaryText={(record) => record.name} />
        </ArrayField>
        <ArrayField source="skills">
          <SingleFieldList>
            <ChipField source="name" />
          </SingleFieldList>
        </ArrayField>
  </Show>
);

What happened instead:

The <SimpleList> is rendered empty. It's not the case with the <SingleFieldList>.

Sélection_004

Steps to reproduce:

I've written an example on CodeSandbox: https://codesandbox.io/s/sweet-mendeleev-jq98y?file=/src/users/UserShow.tsx.

Related code:

The <ArrayField> computes a total of null. But the <SimpleList> is not rendered if the total is not > 0.

Environment

  • React-admin version: 3.19.3
  • Last version that did not exhibit the issue (if applicable): ?
  • React version: /
  • Browser: /
  • Stack trace (in case of a JS error): /
@WiXSL
Copy link
Contributor

WiXSL commented Dec 15, 2021

Fixed by #6975

@WiXSL WiXSL closed this as completed Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants