react-admin ListGuesser 显示 "No results found"

react-admin ListGuesser showing "No results found"

My Resource -:
<Resource name="ReliabilityEventLog" list={ListGuesser} />


This is my response from the server_:

{
"data": {
"items": [{
"createdAt": "2020-12-04T04:24:00.118Z",
"deletedAt": null,
"eventName": "Confirmed Withdraw* between 5 and 24 hrs",
"eventDate": "2020-12-04T00:00:00.000Z",
"eventPoint": -20,
"shiftId": 44332,
"facilityName": "Tester Facility Friendswood",
"facilityId": 927,
"id": 4,
"nurseId": 12508,
]}}

ListGuesser 呈现“未找到结果”并且数据是从网络选项卡返回的。

是否对此行为有任何解释或如何解决?我们将不胜感激任何帮助。

您的 dataProvider.getList() 应该 return 一个包含 'data' 键中记录数组的对象:

{
"data": [{
     "createdAt": "2020-12-04T04:24:00.118Z",
     "deletedAt": null,
     "eventName": "Confirmed Withdraw* between 5 and 24 hrs",
     "eventDate": "2020-12-04T00:00:00.000Z",
     "eventPoint": -20,
     "shiftId": 44332,
     "facilityName": "Tester Facility Friendswood",
     "facilityId": 927,
     "id": 4,
     "nurseId": 12508,
   }]
}

dataProvider响应格式详见react-admin官方文档:

https://marmelab.com/react-admin/DataProviders.html#response-format

问题出在我的 graphQL 服务器没有返回查询计数,因此 dataProvider 无法成功对结果进行分页,从而导致无法呈现。