GraphQL: Subclass offset based pagination
What does this MR do?
Keyset / stable cursor based pagination currently has limits, and can not be used in all ActiveRecord::Relation
cases. However by default we use keyset pagination for every ActiveRecord::Relation
.
A new Gitlab::Graphql::Pagination::OffsetActiveRecordRelationConnection
simply subclasses from the graphql
gem GraphQL::Relay::RelationConnection
, and allows us to use offset pagination when necessary. Many times it is good enough, and allows us to support reasonable pagination in cases that KeySet pagination doesn't support.
Once we upgrade to 1.10.x
in #207278 (closed), we'l migrate the class to use the new GraphQL::Pagination::ActiveRecordRelationConnection
.
The reason for putting this class in gitlab/graphql/pagination
instead of gitlab/graphql/connections
is because 1.10.x
now places connections in the pagination
directory. An upcoming MR will refactor other connections into this directory structure.
Related to #36758 (closed)
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team