diff --git a/apps/web/src/lib/queries.ts b/apps/web/src/lib/queries.ts index 9ebe1b7..51d77df 100644 --- a/apps/web/src/lib/queries.ts +++ b/apps/web/src/lib/queries.ts @@ -63,9 +63,12 @@ export async function listAccounts(operatorId: string) { // exposes Pair / Re-pair / Delete actions accordingly. Hiding rows // by status produced phantom "I created an account but it's gone" // bug reports. + // Earliest-added on top, newest at the bottom. Stable across renames + // (a label edit shouldn't reorder the list and confuse muscle memory) + // and matches how other admin tools order accounts that grow over time. return db.query.whatsappAccounts.findMany({ where: (a, { eq }) => eq(a.operatorId, operatorId), - orderBy: (a, { asc }) => [asc(a.label)], + orderBy: (a, { asc }) => [asc(a.createdAt), asc(a.id)], }); }