apollographql / apollographql/fullstack-tutorial

Error when fetching past end of Launches

Open
#91 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
808
PR merge metrics
No merged PRs in 30d

Description

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:
Screen Shot 2019-07-13 at 8 22 12 PM

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.