Skip to content

Fix Releases page pagination after sort change

Nathan Friend requested to merge nfriend-fix-sort-change-pagination-bug into master

What does this MR do?

Fixes #332063 (closed) by resetting the pagination when the user changes the sort field.

Why?

GraphQL pagination cursors are tied to a specific sort field. A pagination cursor can only be used to request a new page of results sorted by the same criteria.

Previously, the page allowed the user to change the sort criteria ("Released date" vs "Created date"), but made a request using the pagination from the previous request, resulting in a mismatch between the sort and pagination.

This MR avoids this issue by clearing the pagination cursors (and URL query parameters) whenever the sort criteria of the page is changed by the user.

Feature flag note

There are two versions of this page:

  • A Vuex version (the "old" version) which is displayed when the releases_index_apollo_client flag is disabled
  • An Apollo Client version (the "new" version) which is displayed when the releases_index_apollo_client flag is enabled

This fix only applies to the Apollo Client version (the "new" version). We will most likely not fix the "old" version of this page since the feature flag is being enabled by default in !63334 (merged), after which the "old" version will be removed.

GIFS

Before

2021-06-07_15.06.25

After

2021-06-07_15.08.58

Related to #332063 (closed)

Edited by Nathan Friend

Merge request reports

Loading