Exposed sort criteria not respecting default value

Created on 8 September 2022, over 2 years ago
Updated 8 May 2024, 11 months ago

Problem/Motivation

When a view has multiple handlers in the sort criteria where the first one is not exposed but the second one is exposed and the sort order for it is also exposed, views is not respecting the default order value for the exposed sort criteria, it is instead using the default order value of the first sort handler.

Steps to reproduce

1. Create a new view.
2. Add a first sort criteria, with order ASC and do not expose it.
3. Add a second sort criteria, with default ordered DESC and expose it.
4. In the exposed form settings, configure it so that the sort order is also exposed.
5. Save your view.
6. Visit your page, you will see the results are ordered by first sort criteria and then second (which is fine), but the default order for the second criteria (the one exposed) is ASC instead of DESC (which was the default order value defined for the exposed sort field).

Proposed resolution

Instead of using the sort order of the default value from the first sort, use the one from the first exposed sort.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated 1 day ago

Created by

πŸ‡¨πŸ‡·Costa Rica dharizza

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024