You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As mentioned by another user on Discord (possibly @Karabur?), this does not make sense. In order for getList to function correctly with various integration points within Refine (like the MUI useDataGrid hook), response[operation] must return an array of objects. An array cannot have additional properties on it such as count. I'm not sure I understand how anybody could be using this default data provider out of the box with working pagination.
Steps To Reproduce
N/A. Per the graphQL spec, a list cannot have additional properties.
Hey @jamesdh you are right, it's a bit illogical to expect a field in an array. GraphQL data provider, due to nature of GraphQL can't fit into every API so it's more like a blueprint to start building your own data provider. I just checked and it seems we are missing asserting count field in the tests. Nevertheless, this can be fixed to avoid confusion.
GraphQL data provider, due to nature of GraphQL can't fit into every API
True, but there are conventions for this frequently found in the wild that are based on the Relay spec. Specifically, Relay has the concept of Connection types. Connections must contain a PageInfo field. What you commonly see "in the wild" (but that is not part of the official spec) is that either the Connection object itself or the PageInfo object contain a "totalCount" property. I believe it's usually found on the Connection object, since it should not change between paginations (and hence it makes less sense for it to be on the PageInfo object).
In any case, the "path" in the object graph where this count property can be found should be something that is definable in the meta object along with the query. The same is true for where the intended data can be found, and thus #5943 could be fixed.
Describe the bug
The default GraphQL providers
getList
function return the followingGetListResponse
shaped object:refine/packages/graphql/src/dataProvider/index.ts
Lines 39 to 42 in 3046f96
As mentioned by another user on Discord (possibly @Karabur?), this does not make sense. In order for
getList
to function correctly with various integration points within Refine (like the MUIuseDataGrid
hook),response[operation]
must return an array of objects. An array cannot have additional properties on it such ascount
. I'm not sure I understand how anybody could be using this default data provider out of the box with working pagination.Steps To Reproduce
N/A. Per the graphQL spec, a list cannot have additional properties.
Expected behavior
I do not see how any GraphQL API could provide a response that would provide working pagination for the default GraphQL provider. Even the docs for useList indicate something considerably different, more akin to a Relay response.
Packages
Additional Context
No response
The text was updated successfully, but these errors were encountered: