stormy-gold
stormy-gold7mo ago

What determines the list page count when using graphql data provider?

What determines the list page count when using graphql data provider?**
2 Replies
kapa.ai
kapa.ai7mo ago
Hi @kraloz. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The list page count when using the GraphQL data provider in Refine is determined by the total value returned from the data provider. This value is independent of the pagination mode. If you're facing issues with the total count, it might be because your API is not returning a total value. In such cases, you can swizzle your data provider and customize the getList method to ensure the total value is being sent correctly. Here's an example of a GraphQL response structure where the count is returned at the same level as data:
{
"data": {
"inventoryCompanies": [
{
"id": 22,
"name": "Logitech",
"status": "ACTIVE",
"archived": false,
"numberOfItems": 2
}
],
"count": 1
}
}
{
"data": {
"inventoryCompanies": [
{
"id": 22,
"name": "Logitech",
"status": "ACTIVE",
"archived": false,
"numberOfItems": 2
}
],
"count": 1
}
}
In this example, total: response[operation].count should work if you don't swizzle. However, the exact implementation might depend on your specific data provider and backend setup. If you're still facing issues, you might need to debug your code after swizzling. For more information on how to use the GraphQL data provider with Refine, you can refer to the official documentation (https://refine.dev/docs/packages/documentation/data-providers/graphql). Sources: - Discord support thread: Clientside Pagination Total Count (https://discord.com/channels/837692625737613362/1090367190219370526) - Refine vs React-Admin Which is Better for Your Project? (https://refine.dev/blog/refine-vs-react-admin/) - Refine vs AdminBro - Comparison Admin Panel Framework (https://refine.dev/blog/refine-vs-adminbro/) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7mo ago
<@240270957686554624> kapa.ai is still learning and improving, please let us know how it did by reacting below