Skip to content

Fix disappearing ORDER BY when keyset paginating

Adam Hegyi requested to merge 345833-fix-missing-keyset-pagination-ordering into master

What does this MR do and why?

Fixes: #345833 (closed)

Ordering by pipelines.id DESC within the package node does not work as expected. For some reason, when requesting the second page the ActiveRecord::Relation object loses its order_values after a dup call (no ORDER BY clause).

So far, I was able to reproduce the bug with the Packages::Package records only which might indicate that the has_many through association combined with reorder! could be the source of the problem (not confirmed). Note: id DESC is our default ordering in GraphQL, so we should have seen several reported issues if it's a "global" problem.

Eliminating the dup in the Keyset::Order class fixed the problem.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #345833 (closed)

Edited by Mayra Cabrera

Merge request reports