feat(web): sort accounts by created_at ascending (earliest first)
Earlier accounts were ordered by label, so the list reshuffled every time an account was renamed. Switch to created_at ASC + id ASC as a deterministic tiebreaker. Earliest-added accounts now stay on top where the operator added them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7df3ef9c31
commit
f566e4683a
@ -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)],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user