Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Relay/Connection/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ public function forward($args)

// If we don't have a cursor or if it's not valid, then we must not use the slice method
if (!is_numeric(ConnectionBuilder::cursorToOffset($args['after'])) || !$args['after']) {
$entities = call_user_func($this->fetcher, $offset, $limit + 1);
$entities = call_user_func($this->fetcher, $offset, $limit ? $limit + 1 : $limit);

return $this->handleEntities($entities, function ($entities) use ($args) {
return ConnectionBuilder::connectionFromArray($entities, $args);
});
} else {
$entities = call_user_func($this->fetcher, $offset, $limit + 2);
$entities = call_user_func($this->fetcher, $offset, $limit ? $limit + 2 : $limit);

return $this->handleEntities($entities, function ($entities) use ($args, $offset) {
return ConnectionBuilder::connectionFromArraySlice($entities, $args, [
Expand Down