4

I am using react-admin 3.1.1

I have one to one relationship between employee and user through email.

I am using graphql on backend.

Here is the code:

<ReferenceField disabled
        label="Registered user"
        source="email"
        reference="RaUser"
        link="show"
      >
        <FunctionField  render={record => {console.log('record', record); return `${record.first_name} ${record.last_name} - ${record.email}`}}  />
      </ReferenceField> 

I can see in the network tab that the request goes through and there is data. However, the reference field is not rendering any children I was trying to console log data in render function in FunctionField but the console.log is not even getting called.

Can somebode help me what to do in order to make it work?

Kia Kaha
  • 1,565
  • 1
  • 17
  • 39
Filozof6
  • 41
  • 1
  • 2
  • Have you tried with putting `` to test if it fails with different fields? Otherwise the code looks fine if reference's value is correct. Perhaps providing the response data could help solving the issue – Kia Kaha Mar 01 '21 at 13:01
  • I tried id, email and the function field. Right now I am not totally sure what is happening I have tried even the ReferenceManyField and the result was the same, no child rendered. May it be the primary key column problem? I have other reference fields in my project that are functioning correctly but only here I am not using IDs but an email. But I can clearly see that the network request comes through with valid and correct data just the reference field behaves like nothing have arrived – Filozof6 Mar 01 '21 at 13:27
  • Could you provide the records structure (jsons) - both the user's entity and the current one which you are trying to view? – Kia Kaha Mar 01 '21 at 13:56
  • User: `{id: "1", first_name: "Khalid", last_name: "Wehner", email: "email@email.com",…}` Employee: `{id: "2", email: "email@email.com",…}` – Filozof6 Mar 02 '21 at 08:54

0 Answers0