From dee4d69b40787a511e0a3228a4dc92d5fc815047 Mon Sep 17 00:00:00 2001
From: Vadym Samoilenko
Date: Wed, 29 Apr 2026 15:20:38 +0100
Subject: [PATCH] fix: raise user list size limit to 500 and guard
toLocaleString calls
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- routes_admin.py: size query param max raised from 100 → 500 so
ClientDetail.tsx (size=200) no longer returns 422
- GlossaryDetail.tsx: three .toLocaleString() calls guarded with ?? 0
to prevent TypeError when term_count is undefined on first render
Co-Authored-By: Claude Sonnet 4.6
---
backend/app/api/v1/routes_admin.py | 2 +-
frontend/src/routes/admin/glossaries/GlossaryDetail.tsx | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/backend/app/api/v1/routes_admin.py b/backend/app/api/v1/routes_admin.py
index 4a29cfb..1ef39dd 100644
--- a/backend/app/api/v1/routes_admin.py
+++ b/backend/app/api/v1/routes_admin.py
@@ -30,7 +30,7 @@ router = APIRouter(prefix="/admin", tags=["admin"])
@router.get("/users", response_model=UserListResponse)
async def list_users(
page: int = Query(1, ge=1),
- size: int = Query(20, ge=1, le=100),
+ size: int = Query(20, ge=1, le=500),
role: Optional[str] = Query(None),
active_only: bool = Query(True),
current_user: User = Depends(require_roles(UserRole.ADMIN)),
diff --git a/frontend/src/routes/admin/glossaries/GlossaryDetail.tsx b/frontend/src/routes/admin/glossaries/GlossaryDetail.tsx
index 622126c..aba272e 100644
--- a/frontend/src/routes/admin/glossaries/GlossaryDetail.tsx
+++ b/frontend/src/routes/admin/glossaries/GlossaryDetail.tsx
@@ -114,7 +114,7 @@ export function GlossaryDetail() {
Source: {glossary.source_locale}
{activeVersion && (
- <> · Active: v{activeVersion.version_number} · {activeVersion.term_count.toLocaleString()} terms>
+ <> · Active: v{activeVersion.version_number} · {(activeVersion.term_count ?? 0).toLocaleString()} terms>
)}
{activeVersion && (
@@ -231,7 +231,7 @@ export function GlossaryDetail() {
) : (
<>
- {termsData?.total.toLocaleString()} terms total
+ {(termsData?.total ?? 0).toLocaleString()} terms total
@@ -307,7 +307,7 @@ export function GlossaryDetail() {
)}
- {v.term_count.toLocaleString()} terms · uploaded {new Date(v.created_at).toLocaleDateString()}
+ {(v.term_count ?? 0).toLocaleString()} terms · uploaded {new Date(v.created_at).toLocaleDateString()}
{v.change_note && "{v.change_note}"
}