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

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
  1. 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.

We are considering removing this database persisted value in favor of the local storage.

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
Edited by Shane Maglangit