File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 1- import { useRafInterval } from 'ahooks' ;
21import { Switch , SwitchProps , Typography } from 'antd' ;
32import { BAIFlex } from 'backend.ai-ui' ;
43import React from 'react' ;
4+ import { useInterval } from 'src/hooks/useIntervalValue' ;
55
66const { Text } = Typography ;
77
88interface Props extends SwitchProps {
99 children ?: React . ReactNode ;
1010 onRefresh : ( ) => void ;
11- interval ? : number ;
11+ interval : number | null ;
1212}
1313
1414const AutoRefreshSwitch : React . FC < Props > = ( {
1515 children,
16- interval = 5_000 ,
16+ interval = null ,
1717 onRefresh,
1818 ...switchProps
1919} ) => {
20- useRafInterval (
20+ useInterval (
2121 ( ) => {
2222 onRefresh ( ) ;
2323 } ,
24- switchProps . checked ? interval : undefined ,
24+ switchProps . checked ? interval : null ,
2525 ) ;
2626
2727 return (
Original file line number Diff line number Diff line change @@ -219,15 +219,15 @@ const ContainerLogModal: React.FC<ContainerLogModalProps> = ({
219219 < AutoRefreshSwitch
220220 checked = { autoRefreshEnabled }
221221 onChange = { setAutoRefreshEnabled }
222- interval = { autoRefreshIntervalValue }
222+ interval = { isRefetching ? null : autoRefreshIntervalValue }
223223 onRefresh = { ( ) => {
224224 refetch ( ) ;
225225 } }
226226 >
227227 { t ( 'button.AutoRefresh' ) } :
228228 </ AutoRefreshSwitch >
229229 < InputNumber
230- min = { 1 }
230+ min = { 3 }
231231 value = { ( autoRefreshIntervalValue ?? 1000 ) / 1000 }
232232 onChange = { ( value ) => {
233233 if ( typeof value === 'number' ) {
You can’t perform that action at this time.
0 commit comments