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)