@@ -10,15 +10,12 @@ import available_aggregators from "../aggregators-list";
10
10
import { useRouter } from "next/router" ;
11
11
import EpochSettings from "../components/EpochSettings" ;
12
12
import { useDispatch , useSelector } from "react-redux" ;
13
- import { toggleAutoUpdate } from "../store/settingsSlice" ;
13
+ import { setUpdateInterval , toggleAutoUpdate } from "../store/settingsSlice" ;
14
14
15
15
function IntervalSetter ( props ) {
16
16
const autoUpdate = useSelector ( ( state ) => state . settings . autoUpdate ) ;
17
+ const updateInterval = useSelector ( ( state ) => state . settings . updateInterval ) ;
17
18
const dispatch = useDispatch ( ) ;
18
-
19
- function handleChange ( event ) {
20
- props . onIntervalChange ( parseInt ( event . target . value ) ) ;
21
- }
22
19
23
20
return (
24
21
< Form . Group as = { Col } className = { props . className } >
@@ -27,7 +24,7 @@ function IntervalSetter(props) {
27
24
< Button type = "button" onClick = { ( ) => dispatch ( toggleAutoUpdate ( ) ) } variant = { autoUpdate ? "primary" : "success" } >
28
25
{ autoUpdate ? "Pause ⏸" : "Resume ▶" }
29
26
</ Button >
30
- < Form . Select value = { props . interval } onChange = { handleChange } >
27
+ < Form . Select value = { updateInterval } onChange = { ( e ) => dispatch ( setUpdateInterval ( e . target . value ) ) } >
31
28
< option value = { 1000 } > 1 seconds</ option >
32
29
< option value = { 5000 } > 5 seconds</ option >
33
30
< option value = { 10000 } > 10 seconds</ option >
@@ -40,8 +37,6 @@ function IntervalSetter(props) {
40
37
export default function Explorer ( ) {
41
38
const router = useRouter ( ) ;
42
39
const [ aggregator , setAggregator ] = useState ( available_aggregators [ 0 ] ) ;
43
- const [ interval , setInterval ] = useState ( 10000 ) ;
44
- const autoUpdate = useSelector ( ( state ) => state . settings . autoUpdate ) ;
45
40
46
41
useEffect ( ( ) => {
47
42
if ( router . query ?. aggregator && router . query ?. aggregator !== aggregator ) {
@@ -80,20 +75,18 @@ export default function Explorer() {
80
75
aggregator = { aggregator }
81
76
onAggregatorChange = { handleApiChange }
82
77
defaultAvailableAggregators = { available_aggregators } />
83
- < IntervalSetter
84
- interval = { interval }
85
- onIntervalChange = { handleIntervalChange } />
78
+ < IntervalSetter />
86
79
</ Row >
87
80
</ Form >
88
81
< Row >
89
82
< Col >
90
- < EpochSettings aggregator = { aggregator } updateInterval = { interval } />
83
+ < EpochSettings aggregator = { aggregator } />
91
84
</ Col >
92
85
< Col xs = { 8 } >
93
- < PendingCertificate aggregator = { aggregator } updateInterval = { interval } />
86
+ < PendingCertificate aggregator = { aggregator } />
94
87
</ Col >
95
88
</ Row >
96
- < SnapshotsList aggregator = { aggregator } updateInterval = { interval } autoUpdate = { autoUpdate } />
89
+ < SnapshotsList aggregator = { aggregator } />
97
90
</ Stack >
98
91
</ main >
99
92
</ div >
0 commit comments