api-platform / api-platform/core

[Laravel] GraphQL Cursor Pagination not working

未關閉
#6,747 2 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
PHP
星號
2.6k
分支
980
平均合併
2 天 5 小時
30 天內合併 PR
48

描述

**API Platform version(s) affected**: 4.0.4
Cursor Pagination with $after, etc... using graphql seems to not work in Laravel.
I think there are 2 Issues with it:

1. It is not really a cursor based pagination (see [this](https://github.com/api-platform/core/issues/8033) issue)
2. It does not seem to be accounted at all (at least not in the laravel implementation) - this might be due to how laravel `simplePaginate` works (assuming that cursor based pagination is considered "partial" pagination, which it isn't automatically) and that there is no offset option for that.

A potential fix could be using laravels `cursorPaginate` function, but some serialization and deserialization of the cursor would need to be also added for this to work. Also GraphQL operations making use of that, should automatically be considered `partial` paginations.

I will try to open a PR for this.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。