fix(types): SchemaReviewQueuePage.total → totalElements (match backend)
User reported бэйдж 'Согласований' в sidebar показывал 0 несмотря на 1
pending schema draft. Root cause:
Backend сериализует Spring Page<SchemaDraft> как:
{items, page, size, totalElements, totalPages}
Но TS type SchemaReviewQueuePage объявлял поле как 'total' (mismatch
именования). Consumers читали data?.total → undefined → fallback 0:
- useReviewsBadgeCount (queries.ts:650) — sidebar badge падал на 0
- reviews.tsx:61 — header count в Schemas tab (но fallback на
items.length скрывал bug в UI)
- reviews.tsx:593-594 — schema queue subtitle 'N drafts ждут ревью'
Fix:
- client.ts SchemaReviewQueuePage: total → totalElements + totalPages
- 3 consumer'а обновлены на .totalElements
- Backend контракт не меняется — это чисто frontend type alignment
После prod deploy v2.16.3 sidebar badge заработает корректно.
This commit is contained in:
@@ -647,7 +647,7 @@ export const useReviewsBadgeCount = (enabled = true) => {
|
||||
refetchInterval: 60_000,
|
||||
})
|
||||
const recordCount = recordQ.data?.totalElements ?? 0
|
||||
const schemaCount = schemaQ.data?.total ?? 0
|
||||
const schemaCount = schemaQ.data?.totalElements ?? 0
|
||||
return {
|
||||
total: recordCount + schemaCount,
|
||||
recordCount,
|
||||
|
||||
Reference in New Issue
Block a user