From 8bdf3916013f9fd960b6036f5adf9de79922ac7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9E=C3=B3r=C3=B0ur=20H?= Date: Tue, 4 Jun 2024 14:59:27 +0000 Subject: [PATCH] fix(service-portal): Filter for unread. Loading state for total page count (#15090) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../clients/documents-v2/src/lib/documentsClientV2.service.ts | 2 +- libs/service-portal/documents/src/hooks/useDocumentList.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/clients/documents-v2/src/lib/documentsClientV2.service.ts b/libs/clients/documents-v2/src/lib/documentsClientV2.service.ts index 628ac5849df5..40917f084ea8 100644 --- a/libs/clients/documents-v2/src/lib/documentsClientV2.service.ts +++ b/libs/clients/documents-v2/src/lib/documentsClientV2.service.ts @@ -29,7 +29,7 @@ export class DocumentsClientV2Service { ): T { const sanitizedObj = {} as T for (const key in obj) { - if (obj[key]) { + if (obj[key] || key === 'opened') { sanitizedObj[key] = obj[key] } } diff --git a/libs/service-portal/documents/src/hooks/useDocumentList.ts b/libs/service-portal/documents/src/hooks/useDocumentList.ts index 6dbd4cc63703..738424123eef 100644 --- a/libs/service-portal/documents/src/hooks/useDocumentList.ts +++ b/libs/service-portal/documents/src/hooks/useDocumentList.ts @@ -75,10 +75,10 @@ export const useDocumentList = () => { const totalCount = data?.documentsV2?.totalCount || 0 useEffect(() => { const pageCount = Math.ceil(totalCount / pageSize) - if (pageCount !== totalPages && pageCount !== 0) { + if (pageCount !== totalPages && !loading) { setTotalPages(pageCount) } - }, [pageSize, totalCount]) + }, [pageSize, totalCount, loading]) const filteredDocuments = data?.documentsV2?.data || [] const activeArchive = filterValue.archived === true