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
This commit is contained in:
Ritik Kapoor 2025-03-26 10:52:29 +00:00 committed by Harness
parent 0c7097d4b7
commit 07e2a1a5b6

View File

@ -52,7 +52,8 @@ import {
LIST_FETCHING_LIMIT, LIST_FETCHING_LIMIT,
RenameDetails, RenameDetails,
FileSection, FileSection,
PAGE_CONTAINER_WIDTH PAGE_CONTAINER_WIDTH,
PageBrowserProps
} from 'utils/Utils' } from 'utils/Utils'
import { useAppContext } from 'AppContext' import { useAppContext } from 'AppContext'
import { LatestCommitForFile } from 'components/LatestCommit/LatestCommit' import { LatestCommitForFile } from 'components/LatestCommit/LatestCommit'
@ -67,6 +68,7 @@ import { useQueryParams } from 'hooks/useQueryParams'
import { FileCategory, RepoContentExtended, useFileContentViewerDecision } from 'utils/FileUtils' import { FileCategory, RepoContentExtended, useFileContentViewerDecision } from 'utils/FileUtils'
import { useDownloadRawFile } from 'hooks/useDownloadRawFile' import { useDownloadRawFile } from 'hooks/useDownloadRawFile'
import { usePageIndex } from 'hooks/usePageIndex' import { usePageIndex } from 'hooks/usePageIndex'
import { ResourceListingPagination } from 'components/ResourceListingPagination/ResourceListingPagination'
import { Readme } from '../FolderContent/Readme' import { Readme } from '../FolderContent/Readme'
import { GitBlame } from './GitBlame' import { GitBlame } from './GitBlame'
import RenameContentHistory from './RenameContentHistory' import RenameContentHistory from './RenameContentHistory'
@ -156,8 +158,10 @@ export function FileContent({
} }
}, [pdfWidth, ref.current?.clientWidth]) }, [pdfWidth, ref.current?.clientWidth])
const [page] = usePageIndex() const pageBrowser = useQueryParams<PageBrowserProps>()
const { data: commits } = useGet<{ commits: TypesCommit[]; rename_details: RenameDetails[] }>({ 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`, path: `/api/v1/repos/${repoMetadata?.path}/+/commits`,
queryParams: { queryParams: {
limit: LIST_FETCHING_LIMIT, limit: LIST_FETCHING_LIMIT,
@ -525,6 +529,7 @@ export function FileContent({
/> />
) : null} ) : null}
</Container> </Container>
<ResourceListingPagination response={response} page={page} setPage={setPage} />
</> </>
)} )}
</> </>