Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

don't call log/custom-events if the custom events array is empty

Blue Mousea011f42dd1be
diff --git a/web/app/pages/Project/View/ViewProject.tsx b/web/app/pages/Project/View/ViewProject.tsx
index ffe55cd6f..f9dc37ca2 100644
--- a/web/app/pages/Project/View/ViewProject.tsx
+++ b/web/app/pages/Project/View/ViewProject.tsx
@@ -1226,17 +1226,19 @@ const ViewProject = () => {
projectPassword,
mode,
)
- customEventsChart = await getProjectDataCustomEvents(
- id,
- timeBucket,
- '',
- filters,
- from,
- to,
- timezone,
- activeChartMetricsCustomEvents,
- projectPassword,
- )
+ if (activeChartMetricsCustomEvents.length > 0) {
+ customEventsChart = await getProjectDataCustomEvents(
+ id,
+ timeBucket,
+ '',
+ filters,
+ from,
+ to,
+ timezone,
+ activeChartMetricsCustomEvents,
+ projectPassword,
+ )
+ }
rawOverall = await getOverallStats([id], period, from, to, timezone, filters, projectPassword)
} else {
data = await getProjectData(
@@ -1251,17 +1253,19 @@ const ViewProject = () => {
projectPassword,
mode,
)
- customEventsChart = await getProjectDataCustomEvents(
- id,
- timeBucket,
- period,
- filters,
- '',
- '',
- timezone,
- activeChartMetricsCustomEvents,
- projectPassword,
- )
+ if (activeChartMetricsCustomEvents.length > 0) {
+ customEventsChart = await getProjectDataCustomEvents(
+ id,
+ timeBucket,
+ period,
+ filters,
+ '',
+ '',
+ timezone,
+ activeChartMetricsCustomEvents,
+ projectPassword,
+ )
+ }
rawOverall = await getOverallStats([id], period, '', '', timezone, filters, projectPassword)
}
@@ -1888,7 +1892,7 @@ const ViewProject = () => {
}, [mode, activeTab, customMetrics, filters, authLoading, project, isActiveCompare, dateRange, period, timeBucket])
useEffect(() => {
- if (activeTab !== PROJECT_TABS.traffic || authLoading || !project) {
+ if (activeTab !== PROJECT_TABS.traffic || authLoading || !project || activeChartMetricsCustomEvents.length === 0) {
return
}