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

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

View File

@ -20,7 +20,7 @@ const MetricsApplication = ({
getInitialData,
resetInitialData,
}: MetricsProps): JSX.Element => {
const { selectedTime } = useSelector<AppState, GlobalReducer>(
const { minTime, maxTime } = useSelector<AppState, GlobalReducer>(
(state) => state.globalTime,
);
const { error, errorMessage, metricsApplicationLoading } = useSelector<
@ -33,15 +33,16 @@ const MetricsApplication = ({
useEffect(() => {
if (servicename !== undefined) {
getInitialData({
selectedTimeInterval: selectedTime,
serviceName: servicename,
maxTime,
minTime,
});
}
return (): void => {
resetInitialData();
};
}, [servicename, getInitialData, selectedTime, resetInitialData]);
}, [servicename, getInitialData, resetInitialData, maxTime, minTime]);
if (metricsApplicationLoading) {
return <Spinner tip="Loading..." />;

View File

@ -22,7 +22,10 @@ export const GetInitialData = (
/**
* @description This is because we keeping the store as source of truth
*/
if (props.selectedTimeInterval !== globalTime.selectedTime) {
if (
props.maxTime !== globalTime.maxTime &&
props.minTime !== globalTime.minTime
) {
return;
}
@ -30,7 +33,7 @@ export const GetInitialData = (
type: 'GET_INITIAL_APPLICATION_LOADING',
});
const { maxTime, minTime } = GetMinMax(props.selectedTimeInterval, [
const { maxTime, minTime } = GetMinMax(globalTime.selectedTime, [
globalTime.minTime / 1000000,
globalTime.maxTime / 1000000,
]);
@ -117,5 +120,6 @@ export const GetInitialData = (
export interface GetInitialDataProps {
serviceName: Props['service'];
selectedTimeInterval: GlobalReducer['selectedTime'];
maxTime: GlobalReducer['maxTime'];
minTime: GlobalReducer['minTime'];
}