From e180d2ba989971e97a1e8a8a57d328c54b1c2d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=A9rio=20Vieira?= Date: Mon, 30 Mar 2020 15:49:53 -0300 Subject: [PATCH] Update resolvers.md --- docs/source/tutorial/resolvers.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 }; },