Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 2695a7b

Browse files
author
Noah Lee
authored
Fix the pagination bug in the activities page (#434)
1 parent 36c55c7 commit 2695a7b

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

ui/src/views/activities/index.tsx

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect } from 'react';
1+
import { useEffect, useState } from 'react';
22
import { shallowEqual } from 'react-redux';
33
import { Helmet } from 'react-helmet';
44

@@ -38,19 +38,39 @@ export default (): JSX.Element => {
3838
// eslint-disable-next-line
3939
}, [dispatch]);
4040

41-
const onClickSearch = (values: SearchActivitiesValues) => {
41+
const [searchOptions, setSearchOptions] = useState<SearchActivitiesValues>(
42+
{}
43+
);
44+
45+
const search = () =>
4246
dispatch(
4347
searchDeployments({
44-
start: values.period ? values.period[0].toDate() : undefined,
45-
end: values.period ? values.period[1].toDate() : undefined,
46-
productionOnly: values.productionOnly ? values.productionOnly : false,
48+
start: searchOptions.period
49+
? searchOptions.period[0].toDate()
50+
: undefined,
51+
end: searchOptions.period
52+
? searchOptions.period[1].toDate()
53+
: undefined,
54+
productionOnly: searchOptions.productionOnly
55+
? searchOptions.productionOnly
56+
: false,
4757
})
4858
);
59+
60+
const onClickSearch = (values: SearchActivitiesValues) => {
61+
setSearchOptions(values);
62+
search();
4963
};
5064

51-
const onClickPrev = () => dispatch(actions.decreasePage());
65+
const onClickPrev = () => {
66+
dispatch(actions.decreasePage());
67+
search();
68+
};
5269

53-
const onClickNext = () => dispatch(actions.increasePage());
70+
const onClickNext = () => {
71+
dispatch(actions.increasePage());
72+
search();
73+
};
5474

5575
return (
5676
<Main>

ui/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"resolveJsonModule": true,
1515
"isolatedModules": true,
1616
"noEmit": true,
17+
"noImplicitAny": false,
1718
"jsx": "react-jsx"
1819
},
1920
"include": ["src"]

0 commit comments

Comments
 (0)