Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning: Missing translation for key: "";

Tags:

react-admin

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.

like image 785
Aswathy Balan Avatar asked Feb 15 '19 11:02

Aswathy Balan


2 Answers

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

<EditButton label="Edit" />
like image 102
Andrija Ćeranić Avatar answered Oct 10 '22 03:10

Andrija Ćeranić


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.

like image 24
totymedli Avatar answered Oct 10 '22 04:10

totymedli