WebUI: Sort order for groups and users, how to change?

Nextcloud version (eg, 20.0.5): 27.0.2
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Apache2
PHP version (eg, 7.4): 8.1

The issue you are facing:

The default Group and users sort orders make no sense. Cannot seem to change it.

Is this the first time you’ve seen this error? (Y/N): y

Steps to replicate it:

  1. Create a bunch of groups (we have 100+), and join a bunch of users (we have 500)
  2. As an administrator, Go to User Profile icon > Users
  3. Take note that the groups seem to sort by amount of users in the group, NOT alphabetically. This is a problem if you have LOTS of groups. Finding a group by count is nearly impossible, making the default sort method… well useless.
  4. Take a look at the sort order of Users. it “seems” to sort aphabetically, but it only does it for the first page view. After that, there seems to be no rhyme or obvious sort order applied.

No real errors to speak of, but how do I fix the sort order?

Here is a screencap of the problem: