react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

Inconsistent rendering of errors in List components

Open fzaninotto opened this issue 2 years ago • 0 comments

What you were expecting:

When the dataProvider.getList() call fails, components rendering a list should render something meaningful and consistent.

What happened instead:

  • For fetcher components
    • <List> renders the error messages twice (once in the notification, once in the <Error> component), and if the content component renders it, too, that's three times
    • <ReferenceManyField> renders the notification (no error component)
  • For content components
    • <Datagrid> and <SimpleList> render <ListNoResults>, which is misleading
    • <SingleFieldList> fails.

Besides, in the <List> component, it is not possible to override / hide the <Error> render (cf https://github.com/marmelab/react-admin/issues/8528#issuecomment-1369117499).

Steps to reproduce:

Check the Storybook for List / Error in Fetch : https://react-admin-storybook.vercel.app/?path=/story/ra-ui-materialui-list-list--error-in-fetch

Capture d’écran 2023-04-04 à 06 33 17

Other information:

Which component should handle the error case? In my opinion, just like for the loading case, it's the content components' responsibility (<Datagrid>, <SimpleList>, etc), not the fetcher component (<List>, etc). But I'm open to discussion on this one.

Environment

  • React-admin version: 4.x
  • Last version that did not exhibit the issue (if applicable): n/a
  • React version: 17
  • Browser: Chrome

fzaninotto avatar Apr 04 '23 05:04 fzaninotto