Groups page always resets chosen sort by order/type when opened again
Hello! In groups page, even though I choose to sort my groups by name, it will always revert back to updated at sort when I click my home gitlab icon, or when navigating from other pages back to groups. ![image](/uploads/f942e95f4f7b47a3ce531d46fdcfb531/image.png){width=900 height=191} For example projects page remembers this input and works as intended, so does issues page as well. ### Implementation Guide 1. Ensure that the following MRs has been merged - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/224822+ - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/224209+ 2. Apply the following patch: > [!NOTE] > Using `Project::SORTING_PREFERENCE_FIELD` for the group sorting is semantically wrong. However, this has always been the [same field that we use for group overview page](https://gitlab.com/gitlab-org/gitlab/blob/f14c8dd61db2124051df7b9bda8304de08f550b3/app/controllers/groups/application_controller.rb#L72-L74). > > We are considering removing this database persisted value in favor of the local storage. ```patch Index: app/controllers/dashboard/groups_controller.rb IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/app/controllers/dashboard/groups_controller.rb b/app/controllers/dashboard/groups_controller.rb --- a/app/controllers/dashboard/groups_controller.rb (revision 4a9df15306a71903c03fae1a05f6414ce2d2d0cb) +++ b/app/controllers/dashboard/groups_controller.rb (date 1772008791511) @@ -1,12 +1,16 @@ # frozen_string_literal: true class Dashboard::GroupsController < Dashboard::ApplicationController + include SortingHelper + include SortingPreference include GroupTree skip_cross_project_access_check :index feature_category :groups_and_projects + before_action :set_sorting + urgency :low, [:index] def index @@ -19,4 +23,19 @@ render_group_tree(groups) end + + private + + def default_sort_order + sort_value_name + end + + def sorting_field + Project::SORTING_PREFERENCE_FIELD + end + + def set_sorting + params[:sort] = set_sort_order + @sort = params[:sort] + end end ```
issue