diff --git a/public/components/common/refresh_interval.tsx b/public/components/common/refresh_interval.tsx index 68df681e..9bc24264 100644 --- a/public/components/common/refresh_interval.tsx +++ b/public/components/common/refresh_interval.tsx @@ -38,6 +38,8 @@ const intervalUnitOptions = [ { text: 'hours', value: 'h' }, ]; +const MAX_SIGNED_32_BIT_INTEGER = 2147483647; + export const RefreshInterval = ({ onRefresh, onRefreshChange, @@ -98,9 +100,14 @@ export const RefreshInterval = ({ } } else { if (interval !== null) { + /** + * According https://developer.mozilla.org/en-US/docs/Web/API/setInterval#return_value + * the max delayed value of setInterval is MAX_SIGNED_32_BIT_INTEGER, the inner function will be executed immediately + * if the delayed value is greater than MAX_SIGNED_32_BIT_INTEGER. Add a Math.min here to avoid been executed immediately. + **/ intervalId = window.setInterval(() => { onRefresh(); - }, interval); + }, Math.min(interval, MAX_SIGNED_32_BIT_INTEGER)); } } diff --git a/public/components/monitoring/index.tsx b/public/components/monitoring/index.tsx index ca28790b..798ab021 100644 --- a/public/components/monitoring/index.tsx +++ b/public/components/monitoring/index.tsx @@ -104,28 +104,29 @@ export const Monitoring = (props: MonitoringProps) => { /> {!useNewPageHeader && ( - -

- - ({pagination?.totalRecords ?? 0}) - - ) : undefined, - }} - /> -

-
+ <> + +

+ + ({pagination?.totalRecords ?? 0}) + + ) : undefined, + }} + /> +

+
+ + )} - - {pageStatus !== 'empty' && ( <> - + diff --git a/public/components/monitoring/monitoring_page_header.tsx b/public/components/monitoring/monitoring_page_header.tsx index 4c7c1e40..53fd4630 100644 --- a/public/components/monitoring/monitoring_page_header.tsx +++ b/public/components/monitoring/monitoring_page_header.tsx @@ -35,7 +35,11 @@ export const MonitoringPageHeader = ({ if (useNewPageHeader) { return [ { - renderComponent: , + renderComponent: ( +
+ +
+ ), }, ]; }