From 27e527ad8f52399c51fbbdc63c047393fc41ff1c Mon Sep 17 00:00:00 2001 From: Sharif Date: Mon, 13 Nov 2017 17:59:08 +0000 Subject: [PATCH] Bugfix: [Relay Pagination] Fixed query limit if no 'first' parameter set --- Relay/Connection/Paginator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Relay/Connection/Paginator.php b/Relay/Connection/Paginator.php index b062be391..cd3e0857e 100644 --- a/Relay/Connection/Paginator.php +++ b/Relay/Connection/Paginator.php @@ -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, [