bug(fix): refresh is fixed in the application page (#445)

This commit is contained in:
pal-sig 2021-12-03 18:42:45 +05:30 committed by GitHub
parent 7f116d1597
commit 5414a73b40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -25,10 +25,11 @@ const Metrics = ({ getService }: MetricsProps): JSX.Element => {
useEffect(() => { useEffect(() => {
if (loading === false) { if (loading === false) {
getService({ getService({
selectedTimeInterval: selectedTime, maxTime,
minTime,
}); });
} }
}, [getService, loading, selectedTime]); }, [getService, loading, maxTime, minTime]);
useEffect(() => { useEffect(() => {
let timeInterval: NodeJS.Timeout; let timeInterval: NodeJS.Timeout;
@ -36,7 +37,8 @@ const Metrics = ({ getService }: MetricsProps): JSX.Element => {
if (loading === false && !isSkipped && services.length === 0) { if (loading === false && !isSkipped && services.length === 0) {
timeInterval = setInterval(() => { timeInterval = setInterval(() => {
getService({ getService({
selectedTimeInterval: selectedTime, maxTime,
minTime,
}); });
}, 50000); }, 50000);
} }

View File

@ -13,11 +13,14 @@ export const GetService = (
try { try {
const { globalTime } = getState(); const { globalTime } = getState();
if (props.selectedTimeInterval !== globalTime.selectedTime) { if (
props.maxTime !== globalTime.maxTime &&
props.minTime !== globalTime.minTime
) {
return; return;
} }
const { maxTime, minTime } = GetMinMax(props.selectedTimeInterval, [ const { maxTime, minTime } = GetMinMax(globalTime.selectedTime, [
globalTime.minTime / 1000000, globalTime.minTime / 1000000,
globalTime.maxTime / 1000000, globalTime.maxTime / 1000000,
]); ]);
@ -56,5 +59,6 @@ export const GetService = (
}; };
export type GetServiceProps = { export type GetServiceProps = {
selectedTimeInterval: GlobalReducer['selectedTime']; minTime: GlobalReducer['minTime'];
maxTime: GlobalReducer['maxTime'];
}; };