Ensure time range filter retains selected values (#17147)

This commit is contained in:
Josh Hawkins 2025-03-14 08:27:48 -05:00 committed by GitHub
parent fbd22c8124
commit fe078666c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -254,11 +254,13 @@ function TimeRangeFilterContent({
const [endOpen, setEndOpen] = useState(false);
const [afterHour, beforeHour] = useMemo(() => {
if (!timeRange || !timeRange.includes(",")) {
return [DEFAULT_TIME_RANGE_AFTER, DEFAULT_TIME_RANGE_BEFORE];
if (Array.isArray(timeRange) && timeRange.length === 2) {
return timeRange;
}
return timeRange.split(",");
if (typeof timeRange === "string" && timeRange.includes(",")) {
return timeRange.split(",");
}
return [DEFAULT_TIME_RANGE_AFTER, DEFAULT_TIME_RANGE_BEFORE];
}, [timeRange]);
const [selectedAfterHour, setSelectedAfterHour] = useState(afterHour);