Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

useSWRImmutable for timeseries line in events tab for efficiency

Steven Teyee73ca06453f
diff --git a/apps/web/ui/analytics/events/events-tabs.tsx b/apps/web/ui/analytics/events/events-tabs.tsx
index 7c1980d7ea..7fa4cbe4ab 100644
--- a/apps/web/ui/analytics/events/events-tabs.tsx
+++ b/apps/web/ui/analytics/events/events-tabs.tsx
@@ -10,7 +10,7 @@ import { scaleLinear, scaleUtc } from "@visx/scale";
import { Area, AreaClosed } from "@visx/shape";
import { motion } from "framer-motion";
import { useCallback, useContext, useEffect, useMemo } from "react";
-import useSWR from "swr";
+import useSWRImmutable from "swr/immutable";
import { AnalyticsContext } from "../analytics-provider";
type TimeseriesData = {
@@ -31,7 +31,7 @@ export default function EventsTabs() {
const { baseApiPath, queryString, requiresUpgrade } =
useContext(AnalyticsContext);
- const { data } = useSWR<TimeseriesData>(
+ const { data } = useSWRImmutable<TimeseriesData>(
`${baseApiPath}?${editQueryString(queryString, {
groupBy: "timeseries",
event: demoPage || betaTester ? "composite" : "clicks",