Incorrect initial order when user sorts topic list

AI-generated summary

A bug has been identified in Discourse where the initial sort order of topic lists is incorrect when a user clicks a column header (e.g., β€˜Views’). On the first click, the UI displays an ascending arrow (Λ„) even though the list is sorted in descending order. The sort order also fails to toggle on the second click, though the arrow correctly updates to Λ…. Subsequent clicks behave as expected. The issue is reproducible on Windows 11 and macOS Sonoma using Chrome and Safari, and persists in safe mode. per1234 reported the bug, HAWK confirmed reproducibility on Meta, and david confirmed a fix has been merged and deployed via PR #24465. A brief visual glitch shows the Λ… symbol momentarily before switching to Λ„ on first click.

Priority/Severity:

Medium

Platform

Operating System

  • Windows 11
  • macOS Sonoma

Browser

  • Google Chrome 119.0.6045.124
  • Safari 17.1 (19616.2.9.11.7)

Discourse

38e53b5e8eab64225879a1b855bc50242f2791e5

Description:

The user can choose to sort lists of topics by:

  • Number of replies
  • Number of views
  • Timestamp of latest activity

The criterion by which to sort is selected by clicking the associated column heading.

The sort order is toggled between ascending and descending by subsequent clicks on the column. A Λ„ symbol suffix on the heading indicates ascending sort order and a Λ… symbol indicates descending sort order.

:bug: On the first click on the column, the ascending symbol appears even though the list is sorted in descending order.

:bug: On the second click on the column, the sort order does not toggle.

Reproducible steps:

  1. Open any topic list:
    https://try.discourse.org/
  2. Click the β€œViews” column heading.
    :bug: The Λ„ ascending symbol appears next to the column heading even though the list is sorted in descending order.
  3. Click the β€œViews” column heading.
    :bug: The sort order of the column remains descending instead of switching to ascending as expected.
    :slightly_smiling_face: The sort order symbol changes to Λ…, matching the current sort order.
  4. Click the β€œViews” column heading.
    :slightly_smiling_face: The sort order toggles from descending to ascending.
    :slightly_smiling_face: The sort order symbol changes to Λ„, matching the new sort order.
  5. Click the β€œViews” column heading.
    :slightly_smiling_face: The sort order toggles from ascending to descending.
    :slightly_smiling_face: The sort order symbol changes to Λ…, matching the new sort order.

Additional context

I notice that the Λ… symbol is shown momentarily after the column is selected, before changing to Λ„:

sort


I am able to reproduce the fault on try.discourse.org in β€œsafe mode”.


Originally reported at Issue with sorting new posts by number of replies - Website and Forum - Arduino Forum

3 Likes

Yup, I can repro here on Meta also.

1 Like

Thanks for the report @per1234 - we have a fix in the pipeline for this

EDIT merged and deployed.

3 Likes