mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: handle paginated pull request files page
This commit is contained in:
parent
08bb716ef4
commit
68915bfac4
3 changed files with 14 additions and 5 deletions
|
|
@ -148,10 +148,13 @@ export async function getPullPageDocuments(
|
|||
userName: string,
|
||||
repoName: string,
|
||||
pullId: string,
|
||||
document?: Document,
|
||||
preset?: {
|
||||
url: string
|
||||
document: Document
|
||||
},
|
||||
) {
|
||||
if (document) {
|
||||
return continuousLoadFragmentedPages(window.location.href, document)
|
||||
if (preset) {
|
||||
return continuousLoadFragmentedPages(preset.url, preset.document)
|
||||
}
|
||||
// Response of this contains view of few files but is not complete.
|
||||
return continuousLoadFragmentedPagesFromUrl(`/${userName}/${repoName}/pull/${pullId}/files`)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,12 @@ export async function getPullRequestTreeData(
|
|||
userName,
|
||||
repoName,
|
||||
pullId,
|
||||
isInPullFilesPage() ? document : undefined,
|
||||
isInPullFilesPage()
|
||||
? {
|
||||
url: window.location.href,
|
||||
document,
|
||||
}
|
||||
: undefined,
|
||||
)
|
||||
|
||||
const diffSummaryMap = resolveDiffSummaryMap(docs)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ export async function continuousLoadFragmentedPages(
|
|||
const src = fragment.getAttribute('src')
|
||||
if (src) {
|
||||
// Using `src` without origin below would fail in Firefox if the src is an absolute path
|
||||
return await continuousLoadFragmentedPagesFromUrl(src, docs)
|
||||
// do NOT return here because we need to preserve the first `url` for the final return value
|
||||
await continuousLoadFragmentedPagesFromUrl(src, docs)
|
||||
}
|
||||
}
|
||||
return [new URL(url).pathname, docs]
|
||||
|
|
|
|||
Loading…
Reference in a new issue