Skip to content

Commit c69f55a

Browse files
committed
1 parent 632856d commit c69f55a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/resolvers/connectionResolver.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export function prepareConnectionResolver(
8989
);
9090
const sortOptions: connectionSortOpts = args.sort;
9191

92+
9293
let filter = resolveParams.args.filter || {};
9394
const beginCursorData = cursorToData(args.after);
9495
if (beginCursorData) {
@@ -134,7 +135,7 @@ findManyParams.projection['count'] = true;
134135
findManyParams.projection['age'] = true;
135136
findManyParams.projection['name'] = true;
136137

137-
const hasPreviousPage = skip > 0;
138+
const hasPreviousPage = !!args.last && skip > 0;
138139
let hasNextPage = false; // will be requested +1 document, to check next page presence
139140

140141
const filterDataForCursor = (record) => {
@@ -152,7 +153,7 @@ console.log(findManyParams.args);
152153
const edges = [];
153154
// if returned more than `limit` records, strip array and mark that exists next page
154155
if (recordList.length > limit) {
155-
hasNextPage = true;
156+
hasNextPage = !!args.first;
156157
recordList = recordList.slice(0, limit);
157158
}
158159
// transform record to object { cursor, node }

0 commit comments

Comments
 (0)