File tree Expand file tree Collapse file tree 3 files changed +20
-11
lines changed Expand file tree Collapse file tree 3 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
1818 useBuildState ,
1919 useBuildDispatch ,
2020 deleteBuild ,
21+ selectBuild ,
2122} from "../contexts/build.context" ;
2223import { BuildStatusChip } from "./BuildStatusChip" ;
2324
@@ -48,6 +49,7 @@ const BuildList: FunctionComponent = () => {
4849 selected = { selectedBuildId === build . id }
4950 button
5051 onClick = { ( ) => {
52+ selectBuild ( buildDispatch , build . id ) ;
5153 history . push ( {
5254 search : "buildId=" + build . id ,
5355 } ) ;
Original file line number Diff line number Diff line change @@ -69,11 +69,18 @@ const ProjectPage = () => {
6969
7070 useEffect ( ( ) => {
7171 const queryParams = getQueryParams ( location . search ) ;
72- if ( queryParams . buildId ) {
73- selectBuild ( buildDispatch , queryParams . buildId ) ;
74- } else if ( buildList . length > 0 ) {
75- selectBuild ( buildDispatch , buildList [ 0 ] . id ) ;
72+ if ( ! selectedBuildId ) {
73+ if ( queryParams . buildId ) {
74+ selectBuild ( buildDispatch , queryParams . buildId ) ;
75+ } else if ( buildList . length > 0 ) {
76+ selectBuild ( buildDispatch , buildList [ 0 ] . id ) ;
77+ }
7678 }
79+ // eslint-disable-next-line
80+ } , [ ] ) ;
81+
82+ useEffect ( ( ) => {
83+ const queryParams = getQueryParams ( location . search ) ;
7784 if ( queryParams . testId ) {
7885 setSelectedTestId ( queryParams . testId ) ;
7986 const index = testRuns . findIndex ( ( t ) => t . id === queryParams . testId ) ;
@@ -82,13 +89,7 @@ const ProjectPage = () => {
8289 setSelectedTestId ( undefined ) ;
8390 setSelectedTestRunIndex ( undefined ) ;
8491 }
85- } , [
86- location . search ,
87- buildList ,
88- testRuns ,
89- selectedTestRunIndex ,
90- buildDispatch ,
91- ] ) ;
92+ } , [ location . search , testRuns ] ) ;
9293
9394 useEffect ( ( ) => {
9495 if ( projectId ) {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414} from "@material-ui/core" ;
1515import { buildTestRunUrl } from "../_helpers/route.helpers" ;
1616import { TestVariationDetails } from "../components/TestVariationDetails" ;
17+ import { selectBuild , useBuildDispatch } from "../contexts/build.context" ;
1718
1819const useStyles = makeStyles ( {
1920 media : {
@@ -24,6 +25,7 @@ const useStyles = makeStyles({
2425
2526const TestVariationDetailsPage : React . FunctionComponent = ( ) => {
2627 const classes = useStyles ( ) ;
28+ const buildDispatch = useBuildDispatch ( ) ;
2729 const { testVariationId } = useParams ( ) ;
2830 const [ testVariation , setTestVariation ] = React . useState < TestVariation > ( ) ;
2931
@@ -52,6 +54,10 @@ const TestVariationDetailsPage: React.FunctionComponent = () => {
5254 color = "primary"
5355 component = { Link }
5456 disabled = { ! baseline . testRun }
57+ onClick = { ( ) =>
58+ baseline . testRun &&
59+ selectBuild ( buildDispatch , baseline . testRun . buildId )
60+ }
5561 to = {
5662 baseline . testRun
5763 ? buildTestRunUrl ( testVariation , baseline . testRun )
You can’t perform that action at this time.
0 commit comments