bug fix. remove All time filter for websites with no data.

This commit is contained in:
Francis Cao 2026-01-28 18:05:34 -08:00
parent 9339383497
commit 2df24a78ca

View file

@ -31,9 +31,11 @@ export function WebsiteDateFilter({
const showCompare = allowCompare && !isAllTime; const showCompare = allowCompare && !isAllTime;
const websiteDateRange = useDateRangeQuery(websiteId); const websiteDateRange = useDateRangeQuery(websiteId);
const { startDate, endDate } = websiteDateRange;
const hasData = startDate && endDate;
const handleChange = (date: string) => { const handleChange = (date: string) => {
if (date === 'all') { if (date === 'all' && hasData) {
router.push( router.push(
updateParams({ updateParams({
date: `${getDateRangeValue(websiteDateRange.startDate, websiteDateRange.endDate)}:all`, date: `${getDateRangeValue(websiteDateRange.startDate, websiteDateRange.endDate)}:all`,
@ -78,7 +80,7 @@ export function WebsiteDateFilter({
<DateFilter <DateFilter
value={dateValue} value={dateValue}
onChange={handleChange} onChange={handleChange}
showAllTime={showAllTime} showAllTime={hasData && showAllTime}
renderDate={+offset !== 0} renderDate={+offset !== 0}
/> />
</Row> </Row>