Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit e2bbf04267992ce974da034149f64415a02d6b65
parent 96205fd3f63a65f92bae6712eb203543e8984bff
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sat, 12 Sep 2026 11:57:17 -0400

common: the result list calls the comparator instead of re-typing it

Review finding F1. `rank.ts` shipped with the viewer's ordering in it and
zero viewer callers — which is not a shared comparator, it is a second
copy with better documentation. The result list now calls
`rankByUploadDateDesc`.

Byte-equivalent: the helper IS the inline ternary
(`a.uploadDate === b.uploadDate ? 0 : a.uploadDate < b.uploadDate ? 1 : -1`),
it sorts in place and returns the same array, and Array#sort is stable —
so videos and posts sharing an upload date keep the order the two
append loops built, exactly as before.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Diffstat:
Mcommon/components/SearchSessionContext.tsx | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/common/components/SearchSessionContext.tsx b/common/components/SearchSessionContext.tsx @@ -82,6 +82,7 @@ import type { Post } from "../lib/posts"; import { makeId, splitId } from "./originId"; import { sortGroups, type ChannelGroup } from "../lib/channelGroups"; import { buildSearchHandoff, type SearchHandoff } from "../lib/aiHandoff"; +import { rankByUploadDateDesc } from "../lib/search/rank"; import { pruneSelection, selectGroups } from "../lib/selection"; type Summary = DisplaySummary; @@ -882,9 +883,11 @@ function useSearchSessionState() { }); } // One newest-first ordering across BOTH corpora, so a unified search reads - // as one result set rather than videos-then-posts. - out.sort((a, b) => (a.uploadDate === b.uploadDate ? 0 : a.uploadDate < b.uploadDate ? 1 : -1)); - return out; + // as one result set rather than videos-then-posts. The comparator is + // `lib/search/rank.ts` — same function the next consumer of this ordering + // gets, which is the only reason a shared comparator is worth having. + // Sorts in place and returns the same array, as the inline sort did. + return rankByUploadDateDesc(out); }, [ hasActiveQuery, transcripts,