Relay pagination omits pageInfo fields
Author: r0bustaCreated Jun 25, 2022Updated Mar 19, 2023
Labelsbug 🐛help wanted ⛏️
For some reason, the relayPagination implementation doesn't copy the response pageInfo but instead picks only specific fields.
This behavior doesn't seem correct as it does not conform to the Relay spec. The spec says that the server MAY return hasPreviousPage: true for the forward pagination and hasNextPage: true for the backward one. However, the urql implementation assumes that hasPreviousPage for the forward pagination and hasNextPage, for the backward one, respectively, response fields can be ignored.
I'm happy to contribute a fix for this.
urql version & exchanges:
- urql@^2.2.2
- @urql/exchange-graphcache@^4.4.3
Expected behavior
relayPagination() returns all pageInfo fields regardless of to query variables.
Actual behavior
relayPagination() returns only:
endCursorandhasNextPagewhen query vars haveafterstartCursorandhasPreviousPagewhen query vars havebefore
Source: urql-graphql/urql