From 102ee493f84de83d1d0a94b8c06d688e60793824 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 3 Jun 2026 00:51:12 +0200 Subject: [PATCH] fix(ports): list ports in creation order so the primary port leads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit listPorts() ordered alphabetically, putting "Port Amador" ahead of "Port Nimara" in the switcher and as the default a super-admin lands on. Order by creation instead (oldest first) so the first-seeded port — the primary tenant, Port Nimara — leads. Name is a tiebreaker. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/lib/services/ports.service.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/services/ports.service.ts b/src/lib/services/ports.service.ts index d9afc45a..34bde5de 100644 --- a/src/lib/services/ports.service.ts +++ b/src/lib/services/ports.service.ts @@ -11,7 +11,11 @@ import type { CreatePortInput, UpdatePortInput } from '@/lib/validators/ports'; import { ensureSystemRoots } from '@/lib/services/document-folders.service'; export async function listPorts() { - return db.select().from(ports).orderBy(ports.name); + // Creation order (oldest first), not alphabetical: the first-seeded port + // is the primary one (Port Nimara), so it leads the switcher and is the + // default a super-admin lands on. Alphabetical put "Port Amador" ahead of + // "Port Nimara". Name is a stable tiebreaker for same-instant inserts. + return db.select().from(ports).orderBy(ports.createdAt, ports.name); } export async function getPort(id: string) {