Fix metrics bar not updating on compare mode switch

This commit is contained in:
AymanAlSuleihi 2026-01-09 19:25:07 +00:00
parent 491716f4dd
commit fbf03d6563
2 changed files with 13 additions and 3 deletions

View file

@ -12,6 +12,7 @@ export async function GET(
) {
const schema = z.object({
...dateRangeParams,
compare: z.enum(['prev', 'yoy']).optional(),
...filterParams,
});
@ -31,7 +32,11 @@ export async function GET(
const data = await getWebsiteStats(websiteId, filters);
const { startDate, endDate } = getCompareDate('prev', filters.startDate, filters.endDate);
const { startDate, endDate } = getCompareDate(
filters.compare || 'prev',
filters.startDate,
filters.endDate,
);
const comparison = await getWebsiteStats(websiteId, {
...filters,