From 86963af53870813393b4e7aa10b2357b22ec8d18 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Thu, 22 Oct 2026 19:09:29 +0200 Subject: [PATCH] fix(users): show recently created accounts first --- src/Heimdall.Infrastructure/Persistence/UserRepository.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Heimdall.Infrastructure/Persistence/UserRepository.cs b/src/Heimdall.Infrastructure/Persistence/UserRepository.cs index d6c553a..d2e6763 100644 --- a/src/Heimdall.Infrastructure/Persistence/UserRepository.cs +++ b/src/Heimdall.Infrastructure/Persistence/UserRepository.cs @@ -21,7 +21,11 @@ public class UserRepository : IUserRepository public async Task> GetPagedAsync(int page, int pageSize, CancellationToken ct) { - var query = _db.Users.AsNoTracking().OrderBy(u => u.DisplayName); + // Keep newly created accounts visible on the first page immediately after + // creation, even when the installation has more users than one page. + var query = _db.Users.AsNoTracking() + .OrderByDescending(u => u.CreatedAt) + .ThenBy(u => u.Id); var total = await query.CountAsync(ct).ConfigureAwait(false); var users = await query .Skip((page - 1) * pageSize)