From e7faf701b7cd214ec61702ac5ff62e13ebb362d2 Mon Sep 17 00:00:00 2001 From: Steve Purves Date: Sat, 11 Apr 2026 15:57:08 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20numeric=20sort=20for=20count=20=E2=80=94?= =?UTF-8?q?=20remove=20::text=20cast=20that=20caused=20lexicographic=20ord?= =?UTF-8?q?ering?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Casting total_count and collection_count to ::text in the outer CTE SELECT made ORDER BY treat them as strings, so "4000" sorted before "500". Removing the casts lets ORDER BY operate on bigint. node-postgres returns bigint as strings anyway so the TS interface is unchanged. Also fix search form hidden input: was preserving sort when != "last_seen" (wrong default), now correctly omits sort when == "first_seen" (the default). https://claude.ai/code/session_01C5w4RGRwK9tB9DNmtaUwfc --- web/app/routes/home.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/app/routes/home.tsx b/web/app/routes/home.tsx index 6dcd9c2..81781f3 100644 --- a/web/app/routes/home.tsx +++ b/web/app/routes/home.tsx @@ -91,8 +91,8 @@ export async function loader({ request }: LoaderFunctionArgs) { ) SELECT domain, - collection_count::text, - total_count::text, + collection_count, + total_count, last_seen, first_seen, COUNT(*) OVER ()::text AS total_domains, @@ -306,7 +306,7 @@ export default function Home() { autoComplete="off" /> - {sort !== "last_seen" && ( + {sort !== "first_seen" && ( )} {dir !== "desc" && ( -- knotmirror 0.0.1