diff --git a/docs/source/tutorial/resolvers.md b/docs/source/tutorial/resolvers.md index f1cd9dbbc..a42eda011 100644 --- a/docs/source/tutorial/resolvers.md +++ b/docs/source/tutorial/resolvers.md @@ -194,15 +194,16 @@ module.exports = { pageSize, results: allLaunches }); + + const cursorFrom = items => items[items.length - 1].cursor return { launches, - cursor: launches.length ? launches[launches.length - 1].cursor : null, + cursor: launches.length ? cursorFrom(launches) : null, // if the cursor of the end of the paginated results is the same as the // last item in _all_ results, then there are no more results after this hasMore: launches.length - ? launches[launches.length - 1].cursor !== - allLaunches[allLaunches.length - 1].cursor + ? cursorFrom(launches) !== cursorFrom(allLaunches) : false }; },