Skip to content

Side panel sort: Descending does nothing; the list stays ascending #2203

Open

Description

@SudoThijn

Description

In the side panel's Sort section (CnIndexSidebar, the Search tab of an index page), choosing Descending does nothing: the list reloads in ascending order and Ascending stays selected. In Dossiq this is the Filter panel on All cases. The design board DqZakenSorteren draws "Richting: Oplopend / Aflopend" to turn the order around.

Steps to reproduce

  1. In Dossiq, open All cases (/apps/dossiq/cases) and click Filter.
  2. Under Sort, leave "Sort by" on Deadline (or pick Newest) and click Descending.

Expected behaviour

The list is sorted the other way round, Descending is selected, the line under it reads "Now: by deadline, descending", and the address carries the descending _order.

Actual behaviour

The list loads again with _order={"deadline":"asc","receivedAt":"asc"}. Ascending stays selected, the line keeps "Now: by deadline, ascending", and the address keeps _order=[{"key":"deadline","order":"asc"},{"key":"receivedAt","order":"asc"}]. The same happens for every option in Sort by.

Cause

  • src/components/CnIndexSidebar/CnIndexSidebar.vue:1074-1095: onSortDirection emits sort-change with the reversed keys, and always with the option's value as well.
  • src/components/CnIndexPage/CnIndexPage.vue:11785-11789: onSidebarSortChange tries selectSortOption(value) first. That applies the option's own order (:11816-11821, ascending as declared) and returns, so the reversed keys are never used.
  • CnIndexSidebar.vue:763-769: sortMatch also reports asc whenever an option value is current, so the panel would show Ascending even if the list were reversed.

A fix could let selectSortOption take the direction (or skip it when the keys are the option's keys reversed), and let sortMatch compare the current keys before it falls back to the chosen value.

Acceptance criteria

  • Descending reverses the list for every Sort by option that has a direction
  • The panel shows the chosen direction and the "Now:" line says it
  • The address carries the descending order, and a reload keeps it
  • Choosing Ascending again restores the original order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions