fix(idaa): fix name A→Z / Z→A sort not applying in API revalidation path
The RE-SORT block after API revalidation only checked for 'name' (a legacy sort mode removed when sort_modes was introduced). 'name_asc' and 'name_desc' fell through to the else branch and were silently re-sorted chronologically by tmp_sort_1, overriding the user's selection. Updated to match the fast-path IDB sort logic which already handled all three modes correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -322,11 +322,19 @@ async function handle_search_refresh(qry_key: string) {
|
||||
return true;
|
||||
});
|
||||
|
||||
// RE-SORT: Ensure perfect chronological order even if API puts NULLs last (Refactored 2026-02-16)
|
||||
if ($idaa_loc.recovery_meetings.qry__order_by === 'name') {
|
||||
// RE-SORT: Match the fast-path IDB sort so stale/NULL API ordering is corrected.
|
||||
// WHY: The RE-SORT previously only checked 'name' (a legacy mode that no longer
|
||||
// exists in sort_modes). 'name_asc' and 'name_desc' fell through to the else
|
||||
// branch and were silently re-sorted chronologically, ignoring the user's selection.
|
||||
const sort_order = $idaa_loc.recovery_meetings.qry__order_by;
|
||||
if (sort_order === 'name_asc' || sort_order === 'name') {
|
||||
api_results.sort((a, b) =>
|
||||
(a.name ?? '').localeCompare(b.name ?? '')
|
||||
);
|
||||
} else if (sort_order === 'name_desc') {
|
||||
api_results.sort((a, b) =>
|
||||
(b.name ?? '').localeCompare(a.name ?? '')
|
||||
);
|
||||
} else {
|
||||
api_results.sort((a, b) =>
|
||||
(b.tmp_sort_1 ?? '').localeCompare(a.tmp_sort_1 ?? '')
|
||||
|
||||
Reference in New Issue
Block a user