@@ -34,37 +34,37 @@ async function loadDiffView({ params, url }: PageLoadEvent) {
3434 const { repoName } = parseRepoRevision ( params . repo )
3535 const filePath = decodeURIComponent ( params . path )
3636 const revParam = url . searchParams . get ( 'rev' )
37- const isPerforceDepot = revParam ?. includes ( 'changelist' )
38- const cid = revParam ?. replace ( 'changelist/' , '' )
37+ const cid = revParam ?. includes ( 'changelist' ) && revParam ?. replace ( 'changelist/' , '' )
3938
4039 assertNonNullable ( revisionOverride , 'revisionOverride is set' )
4140
42- return isPerforceDepot ? {
43- type : 'DiffView' as const ,
44- enableInlineDiff : true ,
45- enableViewAtCommit : true ,
46- filePath,
47- commit : client
48- . query ( BlobDiffViewChangelistQuery , {
49- repoName,
50- // @TODO : do better.
51- cid : cid ! ,
52- path : filePath ,
53- } )
54- . then ( mapOrThrow ( result => result . data ?. repository ?. changelist ?. commit ?? null ) ) ,
55- } : {
56- type : 'DiffView' as const ,
57- enableInlineDiff : true ,
58- enableViewAtCommit : true ,
59- filePath,
60- commit : client
61- . query ( BlobDiffViewCommitQuery , {
62- repoName,
63- revspec : revisionOverride ,
64- path : filePath ,
65- } )
66- . then ( mapOrThrow ( result => result . data ?. repository ?. commit ?? null ) ) ,
67- }
41+ return cid
42+ ? {
43+ type : 'DiffView' as const ,
44+ enableInlineDiff : true ,
45+ enableViewAtCommit : true ,
46+ filePath,
47+ commit : client
48+ . query ( BlobDiffViewChangelistQuery , {
49+ repoName,
50+ cid : cid ,
51+ path : filePath ,
52+ } )
53+ . then ( mapOrThrow ( result => result . data ?. repository ?. changelist ?. commit ?? null ) ) ,
54+ }
55+ : {
56+ type : 'DiffView' as const ,
57+ enableInlineDiff : true ,
58+ enableViewAtCommit : true ,
59+ filePath,
60+ commit : client
61+ . query ( BlobDiffViewCommitQuery , {
62+ repoName,
63+ revspec : revisionOverride ,
64+ path : filePath ,
65+ } )
66+ . then ( mapOrThrow ( result => result . data ?. repository ?. commit ?? null ) ) ,
67+ }
6868}
6969
7070async function fetchCodeGraphData (
@@ -214,11 +214,11 @@ async function loadFileView({ parent, params, url }: PageLoadEvent) {
214214 // We can ignore the error because if the revision doesn't exist, other queries will fail as well
215215 revisionOverride : revisionOverride
216216 ? await client
217- . query ( BlobFileViewCommitQuery_revisionOverride , {
218- repoName,
219- revspec : revisionOverride ,
220- } )
221- . then ( result => result . data ?. repository ?. commit )
217+ . query ( BlobFileViewCommitQuery_revisionOverride , {
218+ repoName,
219+ revspec : revisionOverride ,
220+ } )
221+ . then ( result => result . data ?. repository ?. commit )
222222 : null ,
223223 externalServiceType : parent ( )
224224 . then ( ( { resolvedRevision } ) => resolvedRevision . repo ?. externalRepository ?. serviceType )
0 commit comments