File tree Expand file tree Collapse file tree 4 files changed +31
-31
lines changed Expand file tree Collapse file tree 4 files changed +31
-31
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,15 @@ export const useService = (): ServiceInterface => {
3939 } ) ,
4040 ) ;
4141 } , [ ] ) ;
42+ useEffect ( ( ) => {
43+ const intervalId = setInterval ( ( ) => {
44+ //assign interval to a variable to clear it.
45+ dispatch ( runsActions . allRuns ( { } ) ) ;
46+ dispatch ( pipelinesActions . getMy ( ) ) ;
47+ } , 10000 ) ;
48+
49+ return ( ) => clearInterval ( intervalId ) ; //This is important
50+ } ) ;
4251
4352 const setFetching = ( fetching : boolean ) => {
4453 dispatch ( pipelinePagesActions . setFetching ( { fetching } ) ) ;
Original file line number Diff line number Diff line change 1- import { useEffect } from 'react' ;
2- import { pipelinesActions , runsActions } from '../../../redux/actions' ;
1+ // import { useEffect } from 'react';
2+ // import { pipelinesActions, runsActions } from '../../../redux/actions';
33import { organizationSelectors } from '../../../redux/selectors' ;
4- import { useSelector , useDispatch } from '../../hooks' ;
4+ import { useSelector } from '../../hooks' ;
55
66interface ServiceInterface {
77 organization : TOrganization | null ;
88}
99
1010export const useService = ( ) : ServiceInterface => {
1111 const organization = useSelector ( organizationSelectors . myOrganization ) ;
12- const dispatch = useDispatch ( ) ;
12+ // const dispatch = useDispatch();
1313 // useEffect(() => {
1414 // dispatch(pipelinesActions.getMy());
1515 // }, []);
16- useEffect ( ( ) => {
17- const intervalId = setInterval ( ( ) => {
18- //assign interval to a variable to clear it.
19- dispatch ( runsActions . allRuns ( { } ) ) ;
20- dispatch ( pipelinesActions . getMy ( ) ) ;
21- } , 10000 ) ;
2216
23- return ( ) => clearInterval ( intervalId ) ; //This is important
24- } ) ;
2517 return {
2618 organization,
2719 } ;
Original file line number Diff line number Diff line change @@ -47,6 +47,20 @@ export const useService = (): ServiceInterface => {
4747 ) ;
4848 } , [ locationPath ] ) ;
4949
50+ useEffect ( ( ) => {
51+ const intervalId = setInterval ( ( ) => {
52+ //assign interval to a variable to clear it.
53+ dispatch (
54+ stackComponentsActions . getMy ( {
55+ // id: currentWorkspace.id,
56+ type : locationPath . split ( '/' ) [ 2 ] ,
57+ } ) ,
58+ ) ;
59+ } , 10000 ) ;
60+
61+ return ( ) => clearInterval ( intervalId ) ;
62+ } ) ;
63+
5064 const setFetching = ( fetching : boolean ) => {
5165 dispatch ( stackPagesActions . setFetching ( { fetching } ) ) ;
5266 } ;
Original file line number Diff line number Diff line change 1- import { useEffect } from 'react' ;
2- import { stackComponentsActions } from '../../../redux/actions' ;
1+ // import { useEffect } from 'react';
2+ // import { stackComponentsActions } from '../../../redux/actions';
33import { organizationSelectors } from '../../../redux/selectors' ;
44import {
5- useDispatch ,
6- useLocationPath ,
5+ // useLocationPath,
76 // useRequestOnMount,
87 useSelector ,
98} from '../../hooks' ;
@@ -13,24 +12,10 @@ interface ServiceInterface {
1312}
1413
1514export const useService = ( ) : ServiceInterface => {
16- const locationPath = useLocationPath ( ) ;
15+ // const locationPath = useLocationPath();
1716 // const currentWorkspace = useSelector(stackPagesSelectors.currentWorkspace);
1817
19- const dispatch = useDispatch ( ) ;
2018 const organization = useSelector ( organizationSelectors . myOrganization ) ;
21- useEffect ( ( ) => {
22- const intervalId = setInterval ( ( ) => {
23- //assign interval to a variable to clear it.
24- dispatch (
25- stackComponentsActions . getMy ( {
26- // id: currentWorkspace.id,
27- type : locationPath . split ( '/' ) [ 2 ] ,
28- } ) ,
29- ) ;
30- } , 10000 ) ;
31-
32- return ( ) => clearInterval ( intervalId ) ;
33- } ) ;
3419
3520 return {
3621 organization,
You can’t perform that action at this time.
0 commit comments