Skip to content

Commit 0abfd48

Browse files
remove polling from runs (all-runs and pipeline runs) (#497)
1 parent c6696d4 commit 0abfd48

File tree

2 files changed

+47
-47
lines changed

2 files changed

+47
-47
lines changed

src/ui/layouts/AllRuns/Runs/List/useService.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { useEffect } from 'react';
2-
import { runsActions } from '../../../../../redux/actions';
1+
// import { useEffect } from 'react';
2+
// import { runsActions } from '../../../../../redux/actions';
33
import {
44
runSelectors,
55
runPagesSelectors,
6-
workspaceSelectors,
6+
// workspaceSelectors,
77
} from '../../../../../redux/selectors';
8-
import { useDispatch, useSelector } from '../../../../hooks';
8+
import { useSelector } from '../../../../hooks';
99
import { Run } from '../../../../../api/types';
1010

1111
interface ServiceInterface {
@@ -33,30 +33,30 @@ export const useService = ({
3333
}[];
3434
}): ServiceInterface => {
3535
const fetching = useSelector(runPagesSelectors.fetching);
36-
const dispatch = useDispatch();
36+
// const dispatch = useDispatch();
3737
const runs = useSelector(runSelectors.myRuns);
38-
const selectedWorkspace = useSelector(workspaceSelectors.selectedWorkspace);
38+
// const selectedWorkspace = useSelector(workspaceSelectors.selectedWorkspace);
3939
const runsPaginated = useSelector(runSelectors.myRunsPaginated);
40-
const isValidFilter = filter?.map((f) => f.value).join('');
40+
// const isValidFilter = filter?.map((f) => f.value).join('');
4141

42-
useEffect(() => {
43-
if (!isValidFilter && !isExpended) {
44-
const intervalId = setInterval(() => {
45-
//assign interval to a variable to clear it.
46-
dispatch(
47-
runsActions.allRuns({
48-
sort_by: sortBy,
49-
logical_operator: 'and',
50-
workspace: selectedWorkspace,
51-
page: runsPaginated.page,
52-
size: runsPaginated.size,
53-
}),
54-
);
55-
}, 5000);
42+
// useEffect(() => {
43+
// if (!isValidFilter && !isExpended) {
44+
// const intervalId = setInterval(() => {
45+
// //assign interval to a variable to clear it.
46+
// dispatch(
47+
// runsActions.allRuns({
48+
// sort_by: sortBy,
49+
// logical_operator: 'and',
50+
// workspace: selectedWorkspace,
51+
// page: runsPaginated.page,
52+
// size: runsPaginated.size,
53+
// }),
54+
// );
55+
// }, 5000);
5656

57-
return () => clearInterval(intervalId); //This is important
58-
}
59-
});
57+
// return () => clearInterval(intervalId); //This is important
58+
// }
59+
// });
6060
const runIds = runs.map((run: Run) => run.id);
6161

6262
return {

src/ui/layouts/pipelines/PipelineDetail/Runs/useService.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect } from 'react';
2-
import { useDispatch, useSelector } from 'react-redux';
3-
import { pipelinesActions } from '../../../../../redux/actions';
2+
import { useSelector } from 'react-redux';
3+
// import { pipelinesActions } from '../../../../../redux/actions';
44
import {
55
runPagesSelectors,
66
runSelectors,
@@ -33,34 +33,34 @@ export const useService = ({
3333
sortBy: string;
3434
pipelineId: TId;
3535
}): ServiceInterface => {
36-
const dispatch = useDispatch();
36+
// const dispatch = useDispatch();
3737
const fetching = useSelector(runPagesSelectors.fetching);
3838
const runs: Run[] = useSelector(runSelectors.runsForPipelineId(pipelineId));
3939
const runsPaginated = useSelector(runSelectors.myRunsPaginated);
40-
const isValidFilter = filter.map((f) => f.value).join('');
40+
// const isValidFilter = filter.map((f) => f.value).join('');
4141

4242
useEffect(() => {}, [runs]);
43-
useEffect(() => {
44-
if (!isValidFilter && !isExpended) {
45-
const intervalId = setInterval(() => {
46-
//assign interval to a variable to clear it.
43+
// useEffect(() => {
44+
// if (!isValidFilter && !isExpended) {
45+
// const intervalId = setInterval(() => {
46+
// //assign interval to a variable to clear it.
4747

48-
dispatch(
49-
pipelinesActions.allRunsByPipelineId({
50-
sort_by: sortBy,
51-
logical_operator: 'and',
52-
pipelineId: pipelineId,
53-
page: runsPaginated.page,
54-
size: runsPaginated.size,
55-
}),
56-
);
57-
}, 5000);
48+
// dispatch(
49+
// pipelinesActions.allRunsByPipelineId({
50+
// sort_by: sortBy,
51+
// logical_operator: 'and',
52+
// pipelineId: pipelineId,
53+
// page: runsPaginated.page,
54+
// size: runsPaginated.size,
55+
// }),
56+
// );
57+
// }, 5000);
5858

59-
return () => clearInterval(intervalId);
60-
}
61-
//This is important
62-
// eslint-disable-next-line react-hooks/exhaustive-deps
63-
}, [pipelineId, runsPaginated]);
59+
// return () => clearInterval(intervalId);
60+
// }
61+
// //This is important
62+
// // eslint-disable-next-line react-hooks/exhaustive-deps
63+
// }, [pipelineId, runsPaginated]);
6464

6565
const runIds = runs.map((run: Run) => run.id);
6666

0 commit comments

Comments
 (0)