fullstack-tutorial
fullstack-tutorial copied to clipboard
Error when fetching past end of Launches
Cursor is defined as non-nullable:
type LaunchConnection { # add this below the Query type as an additional type.
cursor: String!
hasMore: Boolean!
launches: [Launch]!
}
But if no launches are retrieved (for example if you pass in a cursor for which hasMore was false), then the code will carefully return null for the cursor:
return {
launches,
cursor: launches.length ? launches[launches.length - 1].cursor : null,
Resulting in INTERNAL_SERVER_ERROR:
