7

I am using react-admin for creating my website. But i am getting this warning from list page every time 'Warning: Missing translation for key: "";'

const ListTitle = () => {
    return <span>User Agents</span>;
}

 const SitemapFilter = props => (
    <Filter {...props}>
     <TextInput label="Type" source="type" alwaysOn/>
   </Filter>
   );

  export const SitemapList = props => (
     <List {...props} filters={<SitemapFilter />} title={<ListTitle />}>
    <Datagrid>
     <TextField source="type" label="Type"/>
     <UrlField source="url" label="URL"/>
     <EditButton/>
   </Datagrid>
 </List>
);

I am not able to find the reason. Please advise. Thanks in advance.

Aswathy Balan
  • 484
  • 1
  • 4
  • 15
  • 1
    Hi, after updating the version of React-Admin, I also began to see such a thing, it looks like a bug! – MaxAlex Feb 16 '19 at 12:30
  • You can suppress it by adding an empty key to your custom translation files: '': '', ... – MaxAlex Feb 16 '19 at 12:42

3 Answers3

3

I have found that EditButton component is the cause. Adding label prop to it fixes the issue.

<EditButton label="Edit" />
Andrija Ćeranić
  • 1,633
  • 11
  • 14
  • Thanks..This is working for me also. But now Edit button column title has changed as 'Edit'. But I don't need title for that column in listing table. Do you have any solution for that? – Aswathy Balan Mar 19 '19 at 11:35
  • You could pass an empty label, like `label=""`. I have filed a bug here: https://github.com/marmelab/react-admin/issues/3017 – Andrija Ćeranić Mar 20 '19 at 11:49
  • But if I add label as empty () then, Edit button text is not showing. Only the icon is there. – Aswathy Balan Apr 16 '19 at 08:05
  • I getting this same warning even after adding the label value (using react-admin v2.9.4). – Woodchuck Jul 21 '22 at 21:52
2

tl;dr

Check that your backend returns the proper response!

Explanation

The docs on response format state:

DELETE: { data: {Record|null} } The record that has been deleted (optional)

In our API the backend returned a simple HTTP 204 without a content (obviously). This caused the error:

Warning: Missing translation for key: "Cannot read property 'hasOwnProperty' of undefined"

Changing the response to be the deleted record fixed the issue.

totymedli
  • 29,531
  • 22
  • 131
  • 165
0

If you are also getting maximum call stack size exceeded with this error you may not be returning a not null value from your backend.

For instance, if you have a <TextField source="type" /> and type is required but you return a null value, then you will get this error. The solution is to either make it not required or to return a not null response.

Isaac Pak
  • 4,467
  • 3
  • 42
  • 48