fix: update time stamp on the first load in URL to help with back navigation (#4397)

* fix: update time stamp on the first load in URL to help with back navigation
This commit is contained in:
Vikrant Gupta 2024-01-19 13:52:14 +05:30 committed by GitHub
parent 4a7d972c85
commit f0669a6dc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -279,6 +279,18 @@ function DateTimeSelection({
setRefreshButtonHidden(updatedTime === 'custom');
updateTimeInterval(updatedTime, [preStartTime, preEndTime]);
if (updatedTime !== 'custom') {
const { minTime, maxTime } = GetMinMax(updatedTime);
urlQuery.set(QueryParams.startTime, minTime.toString());
urlQuery.set(QueryParams.endTime, maxTime.toString());
} else {
urlQuery.set(QueryParams.startTime, preStartTime.toString());
urlQuery.set(QueryParams.endTime, preEndTime.toString());
}
const generatedUrl = `${location.pathname}?${urlQuery.toString()}`;
history.replace(generatedUrl);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [location.pathname, updateTimeInterval, globalTimeLoading]);