Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Make websiteId optional in filter controls to enable dashboard filtering
Mike Caoc921231bb95b
diff --git a/src/app/(main)/boards/[boardId]/BoardControls.tsx b/src/app/(main)/boards/[boardId]/BoardControls.tsxindex a9c2be3a5..bed17ad57 100644--- a/src/app/(main)/boards/[boardId]/BoardControls.tsx+++ b/src/app/(main)/boards/[boardId]/BoardControls.tsx@@ -9,16 +9,9 @@ export function BoardControls() {?.flatMap(row => row.columns).map(column => column.component?.websiteId).filter(Boolean);- const fallbackWebsiteId =- componentWebsiteIds && new Set(componentWebsiteIds).size === 1- ? componentWebsiteIds[0]- : undefined;+ const fallbackWebsiteId = componentWebsiteIds?.[0];const websiteId = boardWebsiteId || fallbackWebsiteId;- if (!websiteId) {- return null;- }-return (<Box marginBottom="4"><WebsiteControls websiteId={websiteId} />diff --git a/src/app/(main)/websites/[websiteId]/WebsiteControls.tsx b/src/app/(main)/websites/[websiteId]/WebsiteControls.tsxindex bab7bc303..80b9024f8 100644--- a/src/app/(main)/websites/[websiteId]/WebsiteControls.tsx+++ b/src/app/(main)/websites/[websiteId]/WebsiteControls.tsx@@ -13,7 +13,7 @@ export function WebsiteControls({allowDownload = false,allowCompare = false,}: {- websiteId: string;+ websiteId?: string;allowFilter?: boolean;allowBounceFilter?: boolean;allowDateFilter?: boolean;diff --git a/src/components/common/FilterRecord.tsx b/src/components/common/FilterRecord.tsxindex e255cd7e9..251d29380 100644--- a/src/components/common/FilterRecord.tsx+++ b/src/components/common/FilterRecord.tsx@@ -17,7 +17,7 @@ import { X } from '@/components/icons';import { isSearchOperator } from '@/lib/params';export interface FilterRecordProps {- websiteId: string;+ websiteId?: string;type: string;startDate: Date;endDate: Date;diff --git a/src/components/input/FieldFilters.tsx b/src/components/input/FieldFilters.tsxindex ec8d63241..4856cd1d1 100644--- a/src/components/input/FieldFilters.tsx+++ b/src/components/input/FieldFilters.tsx@@ -23,7 +23,7 @@ import { type FieldGroup, useFields, useMessages, useMobile } from '@/componentsimport { Plus } from '@/components/icons';export interface FieldFiltersProps {- websiteId: string;+ websiteId?: string;value?: { name: string; operator: string; value: string }[];exclude?: string[];match?: string;diff --git a/src/components/input/FilterBar.tsx b/src/components/input/FilterBar.tsxindex 0823e4038..90be256be 100644--- a/src/components/input/FilterBar.tsx+++ b/src/components/input/FilterBar.tsx@@ -20,7 +20,7 @@ import {import { Bookmark, X } from '@/components/icons';import { isSearchOperator } from '@/lib/params';-export function FilterBar({ websiteId }: { websiteId: string }) {+export function FilterBar({ websiteId }: { websiteId?: string }) {const { t, labels } = useMessages();const { formatValue } = useFormat();const {@@ -32,7 +32,8 @@ export function FilterBar({ websiteId }: { websiteId: string }) {} = useNavigation();const { filters, operatorLabels } = useFilters();const { data, isLoading } = useWebsiteSegmentQuery(websiteId, segment || cohort);- const canSaveSegment = filters.length > 0 && !segment && !cohort && !pathname.includes('/share');+ const canSaveSegment =+ !!websiteId && filters.length > 0 && !segment && !cohort && !pathname.includes('/share');const handleCloseFilter = (param: string) => {router.push(updateParams({ [param]: undefined }));diff --git a/src/components/input/FilterEditForm.tsx b/src/components/input/FilterEditForm.tsxindex d8650ec09..6b3353f53 100644--- a/src/components/input/FilterEditForm.tsx+++ b/src/components/input/FilterEditForm.tsx@@ -27,7 +27,7 @@ export function FilterEditForm({ websiteId, onChange, onClose }: FilterEditFormPconst [currentCohort, setCurrentCohort] = useState(cohort);const [currentMatch, setCurrentMatch] = useState<string>(match || 'all');const { isMobile } = useMobile();- const excludeFilters = pathname.includes('/pixels') || pathname.includes('/links');+ const excludeFilters = !websiteId || pathname.includes('/pixels') || pathname.includes('/links');const excludeEvent = !pathname.endsWith('/events') && !pathname.endsWith('/replays');const handleReset = () => {diff --git a/src/components/input/SegmentFilters.tsx b/src/components/input/SegmentFilters.tsxindex 562537d0b..465161e48 100644--- a/src/components/input/SegmentFilters.tsx+++ b/src/components/input/SegmentFilters.tsx@@ -6,7 +6,7 @@ import { useWebsiteSegmentsQuery } from '@/components/hooks';import { ChartPie, UserPlus } from '@/components/icons';export interface SegmentFiltersProps {- websiteId: string;+ websiteId?: string;segmentId: string;type?: string;onChange?: (id: string, type: string) => void;diff --git a/src/components/input/WebsiteDateFilter.tsx b/src/components/input/WebsiteDateFilter.tsxindex e1d2f73d8..3908409cc 100644--- a/src/components/input/WebsiteDateFilter.tsx+++ b/src/components/input/WebsiteDateFilter.tsx@@ -7,7 +7,7 @@ import { getDateRangeValue } from '@/lib/date';import { DateFilter } from './DateFilter';export interface WebsiteDateFilterProps {- websiteId: string;+ websiteId?: string;compare?: string;showAllTime?: boolean;showButtons?: boolean;diff --git a/src/components/input/WebsiteFilterButton.tsx b/src/components/input/WebsiteFilterButton.tsxindex 1f04e2929..ef6f54361 100644--- a/src/components/input/WebsiteFilterButton.tsx+++ b/src/components/input/WebsiteFilterButton.tsx@@ -9,7 +9,7 @@ import { filtersArrayToObject } from '@/lib/params';export function WebsiteFilterButton({websiteId,}: {- websiteId: string;+ websiteId?: string;position?: 'bottom' | 'top' | 'left' | 'right';alignment?: 'end' | 'center' | 'start';}) {