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:
endCursor and hasNextPage when query vars have after
startCursor and hasPreviousPage when query vars have before
For some reason, the
relayPaginationimplementation doesn't copy the responsepageInfobut 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: truefor the forward pagination andhasNextPage: truefor the backward one. However, the urql implementation assumes thathasPreviousPagefor the forward pagination andhasNextPage,for the backward one, respectively, response fields can be ignored.I'm happy to contribute a fix for this.
urql version & exchanges:
Expected behavior
relayPagination()returns allpageInfofields regardless of to query variables.Actual behavior
relayPagination()returns only:endCursorandhasNextPagewhen query vars haveafterstartCursorandhasPreviousPagewhen query vars havebefore