Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
clean-up and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonhawkharris committed Aug 16, 2024
1 parent e7c35db commit 4faee50
Showing 1 changed file with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,37 @@ async function loadDiffView({ params, url }: PageLoadEvent) {
const { repoName } = parseRepoRevision(params.repo)
const filePath = decodeURIComponent(params.path)
const revParam = url.searchParams.get('rev')
const isPerforceDepot = revParam?.includes('changelist')
const cid = revParam?.replace('changelist/', '')
const cid = revParam?.includes('changelist') && revParam?.replace('changelist/', '')

assertNonNullable(revisionOverride, 'revisionOverride is set')

return isPerforceDepot ? {
type: 'DiffView' as const,
enableInlineDiff: true,
enableViewAtCommit: true,
filePath,
commit: client
.query(BlobDiffViewChangelistQuery, {
repoName,
// @TODO: do better.
cid: cid!,
path: filePath,
})
.then(mapOrThrow(result => result.data?.repository?.changelist?.commit ?? null)),
} : {
type: 'DiffView' as const,
enableInlineDiff: true,
enableViewAtCommit: true,
filePath,
commit: client
.query(BlobDiffViewCommitQuery, {
repoName,
revspec: revisionOverride,
path: filePath,
})
.then(mapOrThrow(result => result.data?.repository?.commit ?? null)),
}
return cid
? {
type: 'DiffView' as const,
enableInlineDiff: true,
enableViewAtCommit: true,
filePath,
commit: client
.query(BlobDiffViewChangelistQuery, {
repoName,
cid: cid,
path: filePath,
})
.then(mapOrThrow(result => result.data?.repository?.changelist?.commit ?? null)),
}
: {
type: 'DiffView' as const,
enableInlineDiff: true,
enableViewAtCommit: true,
filePath,
commit: client
.query(BlobDiffViewCommitQuery, {
repoName,
revspec: revisionOverride,
path: filePath,
})
.then(mapOrThrow(result => result.data?.repository?.commit ?? null)),
}
}

async function fetchCodeGraphData(
Expand Down Expand Up @@ -214,11 +214,11 @@ async function loadFileView({ parent, params, url }: PageLoadEvent) {
// We can ignore the error because if the revision doesn't exist, other queries will fail as well
revisionOverride: revisionOverride
? await client
.query(BlobFileViewCommitQuery_revisionOverride, {
repoName,
revspec: revisionOverride,
})
.then(result => result.data?.repository?.commit)
.query(BlobFileViewCommitQuery_revisionOverride, {
repoName,
revspec: revisionOverride,
})
.then(result => result.data?.repository?.commit)
: null,
externalServiceType: parent()
.then(({ resolvedRevision }) => resolvedRevision.repo?.externalRepository?.serviceType)
Expand Down

0 comments on commit 4faee50

Please sign in to comment.