api-platform / api-platform/core

[Laravel] GraphQL Cursor Pagination not working

Aberta
#6,747 2 comentários 1 reação 0 responsáveis Ver no GitHub
Linguagem predominante
PHP
Estrelas
2.6k
Forks
980
Merge médio
2d 5h
PRs com merge (30d)
48

Descrição

**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.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.