Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting scenes by "Last Activated" results in list being sorted in an unexpected way. #22825

Open
3 of 4 tasks
briangunderson opened this issue Nov 14, 2024 · 3 comments
Open
3 of 4 tasks

Comments

@briangunderson
Copy link

Checklist

  • I have updated to the latest available Home Assistant version.
  • I have cleared the cache of my browser.
  • I have tried a different browser to see if it is related to my browser.
  • I have tried reproducing the issue in safe mode to rule out problems with unsupported custom resources.

Describe the issue you are experiencing

When I attempt to sort the grid of the Scenes view by the "Last Activated" column, the table does not sort the way that I would imaging most people would expect (chronologically by the most recent activation of scenes). Rather, it sorts in a way that appears pseudo-random and not in chronological order.

Describe the behavior you expected

List of defined scenes should sort in order of scenes last date/time activation

Steps to reproduce the issue

  1. Open browser window to Home Assistant web front end
  2. Navigate to Settings -> Automations and Scenes
  3. Select the "Scenes" tab at the top of the page
  4. Click the header bar in the resulting table, choosing to sort the table by the "Last Activated" column
  5. Examine the table, paying attention to the order of the rows.
    scenes sorted

...

What version of Home Assistant Core has the issue?

2024.11.1

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Version 130.0.6723.117 (Official Build) (64-bit)

Which operating system are you using to run this browser?

Windows 11 Pro Version 23H2 OS build 22631.4317 Windows Feature Experience Pack 1000.22700.1041.0

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

@karwosts
Copy link
Contributor

Columns can be sorted by ascending, descending, and none. When you hover on the column header with the mouse when sort mode is none, it shows the arrow, as an indication that it is clickable/sortable.

I would guess if you move your mouse cursor away the arrow will disappear, indicating that the column is not currently being sorted?

@briangunderson
Copy link
Author

briangunderson commented Nov 14, 2024

Columns can be sorted by ascending, descending, and none. When you hover on the column header with the mouse when sort mode is none, it shows the arrow, as an indication that it is clickable/sortable.

I would guess if you move your mouse cursor away the arrow will disappear, indicating that the column is not currently being sorted?

Oh man. I can't believe I didn't figure that out. Great catch! The sorting function does work per your instruction. However, and I think this is what threw me off, I would argue that when sorting on a value that indicates relative time, in descending order, that we would put null values last rather than first. This will allow what I imagine is the most common use case of sorting on that field, which is to quickly find the scene that you just triggered in order to edit/debug it. I thought I was viewing the table in ascending order since I saw the first few rows having "Never" in the "Last Activated" column so I clicked it again, thinking it was a simply binary toggle (without realizing that I was in fact choosing the tertiary "none" sort option). I also thought that the arrow had simply disappeared when I was no longer hovering over it in an attempt to provide a cleaner UI, which is why I hovered my mouse over the button to take the screenshot (thinking I was actually just causing the UI to show me the currently selected value rather than the value that I would be selecting by clicking it).

Sorry for the wall of text. I would ask that this issue be refactored into a change request to move null/never to be displayed at the end of the list when sorting by that column (and possibly other columns in other parts of the UI if they are using the same sort/table function(s) if possible.

Thanks!
Brian

@briangunderson
Copy link
Author

scenes sorted 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants