The connection handler does not properly handle null endCursor
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/facebook/relay/blob/cd1e9ae06d114c3e353d384ccbe956e6800a8679/packages/relay-runtime/handlers/connection/ConnectionHandler.js#L219-L221
This conditional is questionable. I believe the spec technically still says that endCursor is non-nullable but that is not how it used in practice nor in the types used in this library.
If edges is empty then logically endCursor doesn't really have a value so null is used. This code should be updated to change the client side page info here to allow null to be set for endCursor.
If a backend returns `hasNextPage` equal to true and `endCursor` equal to null, then the pagination code for `hasMore` should be false. However, you can't ever get that endCursor equal to null to actually get set on this connection so hasMore keeps returning true. Arguable `hasNextPage` should be `false` in that situation, but that is a separate point.
Contributor guide
Assessment
This issue has not been assessed yet.