-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: TA finishing touches and just in case fixes #3487
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { useState } from 'react' | ||
import { useMemo, useState } from 'react' | ||
import { useHistory, useParams } from 'react-router-dom' | ||
|
||
import { Branch, useBranch, useBranches } from 'services/branches' | ||
|
@@ -76,15 +76,20 @@ const BranchSelector = () => { | |
) | ||
} | ||
|
||
const sortedBranchList = overview?.defaultBranch | ||
? [ | ||
const sortedBranchList = useMemo(() => { | ||
if (!branchList?.branches) return [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. adds a check for !branchList?.branches to clean things up a bit And wraps the whole thing in a useMemo |
||
|
||
if (overview?.defaultBranch) { | ||
return [ | ||
// Pins the default branch to the top of the list always, filters it from results otherwise | ||
{ name: overview.defaultBranch, head: null }, | ||
...(branchList?.branches?.filter( | ||
...branchList.branches.filter( | ||
(branch) => branch.name !== overview.defaultBranch | ||
) ?? []), | ||
), | ||
] | ||
: (branchList?.branches ?? []) | ||
} | ||
return branchList.branches | ||
}, [overview?.defaultBranch, branchList.branches]) | ||
|
||
return ( | ||
<div className="flex w-full flex-col gap-1 px-4 lg:w-64 xl:w-80"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,12 +15,14 @@ const FlakeAggregatesSchema = z.object({ | |
__typename: z.literal('Repository'), | ||
testAnalytics: z | ||
.object({ | ||
flakeAggregates: z.object({ | ||
flakeCount: z.number(), | ||
flakeCountPercentChange: z.number().nullable(), | ||
flakeRate: z.number(), | ||
flakeRatePercentChange: z.number().nullable(), | ||
}), | ||
flakeAggregates: z | ||
.object({ | ||
flakeCount: z.number(), | ||
flakeCountPercentChange: z.number().nullable(), | ||
flakeRate: z.number(), | ||
flakeRatePercentChange: z.number().nullable(), | ||
}) | ||
.nullable(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nullable just in case |
||
}) | ||
.nullable(), | ||
}), | ||
|
@@ -100,6 +102,7 @@ export const useFlakeAggregates = ({ | |
status: 404, | ||
data: {}, | ||
dev: 'useFlakeAggregates - 404 Failed to parse data', | ||
error: parsedData.error, | ||
} satisfies NetworkErrorObject) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,18 +22,20 @@ const TestResultsAggregatesSchema = z.object({ | |
defaultBranch: z.string().nullable(), | ||
testAnalytics: z | ||
.object({ | ||
testResultsAggregates: z.object({ | ||
totalDuration: z.number(), | ||
totalDurationPercentChange: z.number().nullable(), | ||
slowestTestsDuration: z.number(), | ||
slowestTestsDurationPercentChange: z.number().nullable(), | ||
totalSlowTests: z.number(), | ||
totalSlowTestsPercentChange: z.number().nullable(), | ||
totalFails: z.number(), | ||
totalFailsPercentChange: z.number().nullable(), | ||
totalSkips: z.number(), | ||
totalSkipsPercentChange: z.number().nullable(), | ||
}), | ||
testResultsAggregates: z | ||
.object({ | ||
totalDuration: z.number(), | ||
totalDurationPercentChange: z.number().nullable(), | ||
slowestTestsDuration: z.number(), | ||
slowestTestsDurationPercentChange: z.number().nullable(), | ||
totalSlowTests: z.number(), | ||
totalSlowTestsPercentChange: z.number().nullable(), | ||
totalFails: z.number(), | ||
totalFailsPercentChange: z.number().nullable(), | ||
totalSkips: z.number(), | ||
totalSkipsPercentChange: z.number().nullable(), | ||
}) | ||
.nullable(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nullable just in case |
||
}) | ||
.nullable(), | ||
}), | ||
|
@@ -115,6 +117,7 @@ export const useTestResultsAggregates = ({ | |
status: 404, | ||
data: {}, | ||
dev: 'useTestResultsAggregates - 404 Failed to parse data', | ||
error: parsedData.error, | ||
} satisfies NetworkErrorObject) | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huge diff but it's just the removal of ??