Order is not respected on back button when admin user list is re-ordered

AI-generated summary

A minor UX bug has been reported where the user list ordering (e.g., by ‘topics viewed’) is not preserved when navigating back from the badges page or clicking ‘users’ after reordering. sam demonstrated the issue with steps and a screenshot. saurabhp, a new Ember contributor, investigated and found that the findAll function is not receiving the order and ascending parameters when returning from badges, unlike on initial page load where a callback correctly passes them. They’re seeking guidance on how to fix this without modifying the core findAll call, which might affect other components. The issue is tagged pr-welcome, indicating it’s open for community contribution.

This is a minor ux bug:

  1. Visit admin/users
  2. re-order list by topics viewed
  3. Click badges
  4. Click back

Second minor bug

  1. Visit admin/users
  2. re-order list by topics viewed
  3. Click badges
  4. Click “users”

Same reordering bug shows up, topics viewed is incorrectly selected.

5 Likes

Hi,
I was able to find out where the issue is. When we load users we fetch users using this:
https://github.com/discourse/discourse/blob/master/app/assets/javascripts/admin/routes/admin-users-list-show.js.es6#L6

Here, we don’t pass the parameter of order(topic_viewed etc) and ascending to findAll function.

But on the first load(refresh), this function gets called by callback:

which again fetches users with order and ascending values.

When we go to badges and come back, this function doesn’t get called by any callback. Can anyone explain to me why?
I don’t want to change the first file to pass ascending and order from params to findAll since it will affect others using that class.

I m new to Ember :bowing_man: Is there any other better way to solve this issue?

Thanks

2 Likes