File tree Expand file tree Collapse file tree 5 files changed +22
-35
lines changed
stackComponents/RunDetail Expand file tree Collapse file tree 5 files changed +22
-35
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import { fetchApiWithAuthRequest } from '../fetchApi';
22import { endpoints } from '../endpoints' ;
33import { httpMethods } from '../constants' ;
44import { apiUrl } from '../apiUrl' ;
5- import mockApi from '../mockApiData' ;
65
76const getGraphRunByIdApi = ( {
87 authenticationToken,
Original file line number Diff line number Diff line change @@ -6,12 +6,7 @@ import {
66 runPagesSelectors ,
77 runSelectors ,
88} from '../../../../redux/selectors' ;
9- import {
10- useDispatch ,
11- useParams ,
12- useRequestOnMount ,
13- useSelector ,
14- } from '../../../hooks' ;
9+ import { useDispatch , useParams , useSelector } from '../../../hooks' ;
1510
1611interface ServiceInterface {
1712 runId : TId ;
@@ -44,6 +39,7 @@ export const useService = (): ServiceInterface => {
4439 ) ;
4540 setIsMounted ( true ) ;
4641 }
42+ // eslint-disable-next-line react-hooks/exhaustive-deps
4743 } , [ isMounted , setIsMounted ] ) ;
4844 // useRequestOnMount(() =>
4945 // runsActions.graphForRun({
@@ -68,11 +64,10 @@ export const useService = (): ServiceInterface => {
6864 // pipelineId,
6965 // }),
7066 // );
71-
72- const fetching = useSelector ( runPagesSelectors . fetching ) ;
7367 const setFetching = ( fetching : boolean ) => {
7468 dispatch ( runPagesActions . setFetching ( { fetching } ) ) ;
7569 } ;
70+ const fetching = useSelector ( runPagesSelectors . fetching ) ;
7671
7772 const billing = useSelector ( billingSelectors . billingForRunId ( id ) ) ;
7873
Original file line number Diff line number Diff line change @@ -7,12 +7,7 @@ import {
77 runPagesSelectors ,
88 runSelectors ,
99} from '../../../../redux/selectors' ;
10- import {
11- useDispatch ,
12- useParams ,
13- useRequestOnMount ,
14- useSelector ,
15- } from '../../../hooks' ;
10+ import { useDispatch , useParams , useSelector } from '../../../hooks' ;
1611
1712interface ServiceInterface {
1813 runId : TId ;
@@ -50,6 +45,7 @@ export const useService = (): ServiceInterface => {
5045 ) ;
5146 setIsMounted ( true ) ;
5247 }
48+ // eslint-disable-next-line react-hooks/exhaustive-deps
5349 } , [ isMounted , setIsMounted ] ) ;
5450
5551 // useRequestOnMount(() =>
Original file line number Diff line number Diff line change @@ -7,12 +7,7 @@ import {
77 runPagesSelectors ,
88 runSelectors ,
99} from '../../../../redux/selectors' ;
10- import {
11- useDispatch ,
12- useParams ,
13- useRequestOnMount ,
14- useSelector ,
15- } from '../../../hooks' ;
10+ import { useDispatch , useParams , useSelector } from '../../../hooks' ;
1611
1712interface ServiceInterface {
1813 runId : TId ;
@@ -51,6 +46,7 @@ export const useService = (): ServiceInterface => {
5146 ) ;
5247 setIsMounted ( true ) ;
5348 }
49+ // eslint-disable-next-line react-hooks/exhaustive-deps
5450 } , [ isMounted , setIsMounted ] ) ;
5551
5652 // useRequestOnMount(() =>
Original file line number Diff line number Diff line change 99import {
1010 useDispatch ,
1111 useParams ,
12- useRequestOnMount ,
12+ // useRequestOnMount,
1313 useSelector ,
1414} from '../../../hooks' ;
1515
@@ -38,19 +38,20 @@ export const useService = (): ServiceInterface => {
3838 // onFailure: () => setFetching(false),
3939 // }),
4040 // );
41- // useEffect(() => {
42- // if (!isMounted) {
43- // setFetching(true);
44- // dispatch(
45- // runsActions.graphForRun({
46- // runId: id,
47- // onSuccess: () => setFetching(false),
48- // onFailure: () => setFetching(false),
49- // }),
50- // );
51- // setIsMounted(true);
52- // }
53- // }, [isMounted, setIsMounted]);
41+ useEffect ( ( ) => {
42+ if ( ! isMounted ) {
43+ setFetching ( true ) ;
44+ dispatch (
45+ runsActions . graphForRun ( {
46+ runId : id ,
47+ onSuccess : ( ) => setFetching ( false ) ,
48+ onFailure : ( ) => setFetching ( false ) ,
49+ } ) ,
50+ ) ;
51+ setIsMounted ( true ) ;
52+ }
53+ // eslint-disable-next-line react-hooks/exhaustive-deps
54+ } , [ isMounted , setIsMounted ] ) ;
5455
5556 // useEffect(() => {
5657 // setFetching(true);
You can’t perform that action at this time.
0 commit comments