From 07e2a1a5b6b70fdb21ed4897c9e7d25c5d697754 Mon Sep 17 00:00:00 2001 From: Ritik Kapoor Date: Wed, 26 Mar 2025 10:52:29 +0000 Subject: [PATCH] fix: [CODE-2993] pagination on commits tab in file history view (#3594) * fix: [CODE-2993] lint check * fix: [CODE-2993] remove unused code * fix: [CODE-2993] remove unused code * fix: [CODE-2993] pagination on commits tab in file history view --- .../RepositoryContent/FileContent/FileContent.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/web/src/pages/Repository/RepositoryContent/FileContent/FileContent.tsx b/web/src/pages/Repository/RepositoryContent/FileContent/FileContent.tsx index d868a8ac7..f1e85b94d 100644 --- a/web/src/pages/Repository/RepositoryContent/FileContent/FileContent.tsx +++ b/web/src/pages/Repository/RepositoryContent/FileContent/FileContent.tsx @@ -52,7 +52,8 @@ import { LIST_FETCHING_LIMIT, RenameDetails, FileSection, - PAGE_CONTAINER_WIDTH + PAGE_CONTAINER_WIDTH, + PageBrowserProps } from 'utils/Utils' import { useAppContext } from 'AppContext' import { LatestCommitForFile } from 'components/LatestCommit/LatestCommit' @@ -67,6 +68,7 @@ import { useQueryParams } from 'hooks/useQueryParams' import { FileCategory, RepoContentExtended, useFileContentViewerDecision } from 'utils/FileUtils' import { useDownloadRawFile } from 'hooks/useDownloadRawFile' import { usePageIndex } from 'hooks/usePageIndex' +import { ResourceListingPagination } from 'components/ResourceListingPagination/ResourceListingPagination' import { Readme } from '../FolderContent/Readme' import { GitBlame } from './GitBlame' import RenameContentHistory from './RenameContentHistory' @@ -156,8 +158,10 @@ export function FileContent({ } }, [pdfWidth, ref.current?.clientWidth]) - const [page] = usePageIndex() - const { data: commits } = useGet<{ commits: TypesCommit[]; rename_details: RenameDetails[] }>({ + const pageBrowser = useQueryParams() + const pageInit = pageBrowser.page ? parseInt(pageBrowser.page) : 1 + const [page, setPage] = usePageIndex(pageInit) + const { data: commits, response } = useGet<{ commits: TypesCommit[]; rename_details: RenameDetails[] }>({ path: `/api/v1/repos/${repoMetadata?.path}/+/commits`, queryParams: { limit: LIST_FETCHING_LIMIT, @@ -525,6 +529,7 @@ export function FileContent({ /> ) : null} + )}