bug: Aggregated total count is not correct due to the presence of first/last/offset parameters
Closed this issue ยท 4 comments
First of all a huge thank you for writing this data connector, really enjoying it so far! ๐ฏ
Our project holds a prisma instance 1.17.1
and after setting up a react-admin
application with a entities List view we found that no pagination was displayed. We dug a bit through the source code and suspect that the issue is due to the fact that the e.g. productsConnection
query get's called with the exact same parameters as the regular products
query. This is an issue since when calling a entityConnection query of the prisma API with parameters such as first
, last
or offset
the total amount does reflect these arameters.
E.g. when sending a query such as
{
productsConnection(first:25) {
aggregate {count}
}
}
prisma will respond with
{
"data": {
"productsConnection": {
"aggregate": {
"count": 25
}
}
}
}
This is not an issue on prisma's side IMO but a task that this connector should solve, e.g. sending a entityConnection query for the total amount of entities with all parameters except first
, last
or offset
.
Hey there ๐ !
Thanks a lot for your detailed issue! It totally makes sens, we indeed just need to extract the first
, last
, offset
from the aggregate query.
I might find the time this week to fix this quickly!
@Inkdpixels @Weakky
this should fix it #20
Please see that I also removed orderBy field (there was no sortField nor sortOrder) as it's not necessary for aggregated count.