API Platform version(s) affected: 2.5.4
Description
GraphQL Pagination skips first element, when there is parameter after set and it's left as empty or set as zero.
How to reproduce
query listAll {
products(name: "", after: "") {
pageInfo {
hasNextPage,
hasPreviousPage,
}
totalCount,
edges {
cursor,
node {
id,
name,
ean,
price,
expiring,
}
}
}
}
or
query listAll {
products(name: "", after: "MA==") {
pageInfo {
hasNextPage,
hasPreviousPage,
}
totalCount,
edges {
cursor,
node {
id,
name,
ean,
price,
expiring,
}
}
}
}
Possible Solution
If parameter empty, return also first (MA==) entry also. Do not return one "after" it. If it is set to 0 (MA==), return 1 (MQ==) as first entry.
Posting a PR soon.