From a1d8a700c0253b9a8f12dcbac3a2ffc04ff7109c Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Thu, 28 Oct 2021 12:11:53 +0300 Subject: [PATCH] Web: Files: fixed Paging re-render --- .../Client/src/pages/Home/Section/Paging/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Paging/index.js b/products/ASC.Files/Client/src/pages/Home/Section/Paging/index.js index e5a833b1bb9..5c4c89df33d 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Paging/index.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Paging/index.js @@ -13,7 +13,7 @@ const SectionPagingContent = ({ selectedCount, selectedFolderId, tReady, - filterTotal, + totalPages, }) => { const { t } = useTranslation("Home"); const onNextClick = useCallback( @@ -105,8 +105,7 @@ const SectionPagingContent = ({ ); const pageItems = useMemo(() => { - if (filterTotal < filter.pageCount) return []; - const totalPages = Math.ceil(filterTotal / filter.pageCount); + if (filter.total < filter.pageCount) return []; return [...Array(totalPages).keys()].map((item) => { return { key: item, @@ -116,7 +115,7 @@ const SectionPagingContent = ({ }), }; }); - }, [filterTotal, filter.pageCount, t]); + }, [filter.total, filter.pageCount, t, totalPages]); const emptyPageSelection = { key: 0, @@ -138,11 +137,11 @@ const SectionPagingContent = ({ const showCountItem = useMemo(() => { if (files && folders) return ( - files.length + folders.length === filter.pageCount || filterTotal > 25 + files.length + folders.length === filter.pageCount || filter.total > 25 ); }, [files, folders, filter, pageItems]); - return !tReady || (filterTotal < filter.pageCount && filterTotal < 26) ? ( + return !tReady || (filter.total < filter.pageCount && filter.total < 26) ? ( <> ) : ( { const { files, folders, fetchFiles, filter, setIsLoading } = filesStore; + const totalPages = Math.ceil(filter.total / filter.pageCount); + return { files, folders, selectedFolderId: selectedFolderStore.id, filter, - filterTotal: filter.total, + totalPages, setIsLoading, fetchFiles,