Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/Search/FilterDropdowns/SortOrderPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {close} from '@libs/actions/Modal';
import Navigation from '@libs/Navigation/Navigation';
import {buildSearchQueryString} from '@libs/SearchQueryUtils';
import {getSortOrderOptions} from '@libs/SearchUIUtils';
import CONST from '@src/CONST';
import SingleSelectPopup from './SingleSelectPopup';

type SortOrderPopupProps = {
Expand Down Expand Up @@ -39,7 +40,7 @@ function SortOrderPopup({queryJSON, onSort, closeOverlay}: SortOrderPopupProps)
items={sortOrderOptions}
value={sortOrder}
closeOverlay={closeOverlay}
defaultValue={sortOrderOptions.at(0)?.value}
defaultValue={CONST.SEARCH.SORT_ORDER.DESC}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Derive reset sort order from query defaults

Using a hardcoded desc here makes Reset incorrect for searches whose default sort order is ascending (for example grouped searches like groupBy:category, from, card, or tag, which are defined as asc in src/libs/SearchParser/searchParser.peggy). In those contexts, pressing Reset in the sort-order popup now applies a non-default order and changes result ordering unexpectedly, so the reset value should be computed from the current query’s default rather than forced to descending.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the production behavior. Did we land on desc order as default value for all popups throughout the app?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for handling all the PR. I was planning to fix all 3 in 1 PR, but I guess that's too late.

I raised my concern about the default value here too.

onChange={(item) => {
if (!item) {
return;
Expand Down
Loading