Skip to content

Allow `Resolver.single` to work with offset pagination [RUN AS-IF-FOSS]

Alex Kalderimis requested to merge ajk-gql-pagination-offset-relation into master

What does this MR do?

This separates out the responsibility of pagination from the relation, and is necessary to test resolvers using Resolver.single if they return an offset paginated relation.

The reason for this is that the single resolver calls super.first (more or less), but on a connection, #first is the value of the first: argument, not the first item in the collection.

For BaseResolver.single to work correctly with offset pagination, we need to return relations from resolve, not connections.

This is a developer-facing tooling change. As such, it does not need a changelog.

The motivating example for this (EpicListsResolver.single) is not currently being used anywhere, and could be removed, but the underlying problem is more fundamental and needs to be fixed.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

This changes the way we return offset paginated relations. We have tests for their behavior, so the chances of negative effects are minimal, but if there are any, it will be visible in incorrect sorting or paginated results. It is possible that internal server errors could be caused if keyset paginated connections are created which raise errors. All of these are very unlikely.

Edited by Alex Kalderimis

Merge request reports

Loading