Skip to content

Commit c96822d

Browse files
authored
Merge pull request #43 from zenml-io/talha/feedback-fixes
fixed polling for pipeline and stackComponents
2 parents 2af8614 + dceeb30 commit c96822d

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

src/ui/layouts/pipelines/Pipelines/useService.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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 }));

src/ui/layouts/pipelines/useService.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
1-
import { useEffect } from 'react';
2-
import { pipelinesActions, runsActions } from '../../../redux/actions';
1+
// import { useEffect } from 'react';
2+
// import { pipelinesActions, runsActions } from '../../../redux/actions';
33
import { organizationSelectors } from '../../../redux/selectors';
4-
import { useSelector, useDispatch } from '../../hooks';
4+
import { useSelector } from '../../hooks';
55

66
interface ServiceInterface {
77
organization: TOrganization | null;
88
}
99

1010
export 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
};

src/ui/layouts/stackComponents/Stacks/useService.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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
};

src/ui/layouts/stackComponents/useService.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { useEffect } from 'react';
2-
import { stackComponentsActions } from '../../../redux/actions';
1+
// import { useEffect } from 'react';
2+
// import { stackComponentsActions } from '../../../redux/actions';
33
import { organizationSelectors } from '../../../redux/selectors';
44
import {
5-
useDispatch,
6-
useLocationPath,
5+
// useLocationPath,
76
// useRequestOnMount,
87
useSelector,
98
} from '../../hooks';
@@ -13,24 +12,10 @@ interface ServiceInterface {
1312
}
1413

1514
export 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,

0 commit comments

Comments
 (0)