fix(idb-sort): correct tmp_sort_* comparator direction in journals, IDAA recovery meetings, and BB post comments
build_tmp_sort() encodes priority=true as '0' for ascending sort. JS comparators were using b.localeCompare(a) (descending), inverting the encoding so priority=false items sorted first. Fixed to a.localeCompare(b) in ae_journals_search_helpers.ts (3 sites in recovery_meetings +page.svelte and wrapper component). Also fixes a Dexie anti-pattern in bb/[post_id]: .reverse() before .sortBy() is a no-op in Dexie; moved array .reverse() to after the await. Documents the encoding rule and legacy inverted-encoding modules in GUIDE__SvelteKit2_Svelte5_DexieJS.md and adds mistake #15 to BOOTSTRAP quickstart. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -255,8 +255,9 @@ async function handle_search_refresh(qry_key: string) {
|
||||
} else {
|
||||
// Robust Chronological Sort using pre-computed tmp_sort_1
|
||||
// Handles Priority, Manual Sort, and the updated_on/created_on fallback
|
||||
// tmp_sort_1 built by build_tmp_sort(): priority=true→'0', so ASC puts priority first.
|
||||
local_results.sort((a, b) =>
|
||||
(b.tmp_sort_1 ?? '').localeCompare(a.tmp_sort_1 ?? '')
|
||||
(a.tmp_sort_1 ?? '').localeCompare(b.tmp_sort_1 ?? '')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -335,8 +336,9 @@ async function handle_search_refresh(qry_key: string) {
|
||||
(b.name ?? '').localeCompare(a.name ?? '')
|
||||
);
|
||||
} else {
|
||||
// tmp_sort_1 built by build_tmp_sort(): priority=true→'0', so ASC puts priority first.
|
||||
api_results.sort((a, b) =>
|
||||
(b.tmp_sort_1 ?? '').localeCompare(a.tmp_sort_1 ?? '')
|
||||
(a.tmp_sort_1 ?? '').localeCompare(b.tmp_sort_1 ?? '')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user