Merge branch 'analytics' into dev

This commit is contained in:
Mike Cao 2024-02-16 19:28:53 -08:00
commit b76f4aa42d
4 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ export function useWebsitePageviews(websiteId: string, options?: { [key: string]
};
return useQuery({
queryKey: ['websites:pageviews', params],
queryKey: ['websites:pageviews', { websiteId, ...params }],
queryFn: () => get(`/websites/${websiteId}/pageviews`, params),
...options,
});

View File

@ -23,7 +23,7 @@ export function useWebsiteStats(websiteId: string, options?: { [key: string]: st
};
return useQuery({
queryKey: ['websites:stats', params],
queryKey: ['websites:stats', { websiteId, ...params }],
queryFn: () => get(`/websites/${websiteId}/stats`, params),
...options,
});

View File

@ -92,7 +92,7 @@ export function DateFilter({
const handleClose = () => setShowPicker(false);
const renderValue = (value: string) => {
const { unit } = parseDateValue(value);
const { unit } = parseDateValue(value) || {};
if (offset && unit === 'year') {
return formatDate(startDate, 'yyyy', locale);

View File

@ -260,7 +260,7 @@ export function getOffsetDateRange(dateRange: DateRange, increment: number) {
const change = num * increment;
const { add } = DATE_FUNCTIONS[unit];
const { unit: originalUnit } = parseDateValue(value);
const { unit: originalUnit } = parseDateValue(value) || {};
switch (originalUnit) {
case 'week':