Skip to content

Commit ffde236

Browse files
committed
update commit detail page query to include isCached field
1 parent 0e9f64a commit ffde236

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/pages/CommitDetailPage/queries/CommitPageDataQueryOpts.test.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ const mockCommitData = {
2323
__typename: 'Comparison',
2424
},
2525
bundleAnalysis: {
26+
bundleAnalysisReport: {
27+
__typename: 'BundleAnalysisReport',
28+
isCached: false,
29+
},
2630
bundleAnalysisCompareWithParent: {
2731
__typename: 'BundleAnalysisComparison',
2832
},
@@ -89,7 +93,7 @@ interface SetupArgs {
8993
isNullOwner?: boolean
9094
}
9195

92-
describe('useCommitPageData', () => {
96+
describe('CommitPageData', () => {
9397
function setup({
9498
isNotFoundError = false,
9599
isOwnerNotActivatedError = false,
@@ -146,6 +150,10 @@ describe('useCommitPageData', () => {
146150
__typename: 'Comparison',
147151
},
148152
bundleAnalysis: {
153+
bundleAnalysisReport: {
154+
__typename: 'BundleAnalysisReport',
155+
isCached: false,
156+
},
149157
bundleAnalysisCompareWithParent: {
150158
__typename: 'BundleAnalysisComparison',
151159
},

src/pages/CommitDetailPage/queries/CommitPageDataQueryOpts.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ import Api from 'shared/api'
1717
import { rejectNetworkError } from 'shared/api/helpers'
1818
import A from 'ui/A'
1919

20+
const BundleAnalysisReportSchema = z.object({
21+
__typename: z.literal('BundleAnalysisReport'),
22+
isCached: z.boolean(),
23+
})
24+
25+
const BundleAnalysisReportUnion = z.union([
26+
BundleAnalysisReportSchema,
27+
MissingHeadReportSchema.shape.__typename,
28+
])
29+
2030
const BundleAnalysisComparisonResult = z.union([
2131
z.literal('BundleAnalysisComparison'),
2232
FirstPullRequestSchema.shape.__typename,
@@ -54,6 +64,7 @@ const RepositorySchema = z.object({
5464
.nullable(),
5565
bundleAnalysis: z
5666
.object({
67+
bundleAnalysisReport: BundleAnalysisReportUnion.nullable(),
5768
bundleAnalysisCompareWithParent: z
5869
.object({
5970
__typename: BundleAnalysisComparisonResult,
@@ -98,6 +109,12 @@ query CommitPageData($owner: String!, $repo: String!, $commitId: String!) {
98109
__typename
99110
}
100111
bundleAnalysis {
112+
bundleAnalysisReport {
113+
__typename
114+
... on BundleAnalysisReport {
115+
isCached
116+
}
117+
}
101118
bundleAnalysisCompareWithParent {
102119
__typename
103120
}
@@ -112,7 +129,8 @@ query CommitPageData($owner: String!, $repo: String!, $commitId: String!) {
112129
}
113130
}
114131
}
115-
}`
132+
}
133+
`
116134

117135
interface CommitPageDataQueryArgs {
118136
provider: string

0 commit comments

Comments
 (0)