🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Update refetch intervals in analytics hooks and components for improved performance
Bill Yang8618c924d474
diff --git a/client/src/api/analytics/hooks/useGetLiveUserCount.ts b/client/src/api/analytics/hooks/useGetLiveUserCount.tsindex 25a08fc49..4ed6bc25f 100644--- a/client/src/api/analytics/hooks/useGetLiveUserCount.ts+++ b/client/src/api/analytics/hooks/useGetLiveUserCount.ts@@ -6,7 +6,7 @@ export function useGetLiveUserCount(minutes = 5) {const { site } = useStore();return useQuery<LiveUserCountResponse>({queryKey: ["live-user-count", site, minutes],- refetchInterval: 5000,+ refetchInterval: 10000,queryFn: () => fetchLiveUserCount(site, minutes),enabled: !!site,});diff --git a/client/src/api/analytics/hooks/useGetUserSessions.ts b/client/src/api/analytics/hooks/useGetUserSessions.tsindex 893342f24..58e5efdf8 100644--- a/client/src/api/analytics/hooks/useGetUserSessions.ts+++ b/client/src/api/analytics/hooks/useGetUserSessions.ts@@ -54,10 +54,12 @@ export function useGetSessionsInfinite({userId,timeOverride,limit = 100,+ refetchInterval,}: {userId?: string;timeOverride?: Time;limit?: number;+ refetchInterval?: number;}) {const { time, site } = useStore();@@ -88,6 +90,7 @@ export function useGetSessionsInfinite({return undefined;},staleTime: Infinity,+ refetchInterval,});}diff --git a/client/src/app/[site]/components/SubHeader/LiveUserCount.tsx b/client/src/app/[site]/components/SubHeader/LiveUserCount.tsxindex 1248cd3a4..111c84172 100644--- a/client/src/app/[site]/components/SubHeader/LiveUserCount.tsx+++ b/client/src/app/[site]/components/SubHeader/LiveUserCount.tsx@@ -28,6 +28,7 @@ export function LiveUserCount() {pastMinutesEnd: 0,},limit: 25,+ refetchInterval: 10000,});// Use the intersection observer hookdiff --git a/client/src/app/[site]/main/components/MainSection/MainSection.tsx b/client/src/app/[site]/main/components/MainSection/MainSection.tsxindex b395f937c..0c886e9e7 100644--- a/client/src/app/[site]/main/components/MainSection/MainSection.tsx+++ b/client/src/app/[site]/main/components/MainSection/MainSection.tsx@@ -92,7 +92,7 @@ export function MainSection() {className={cn("text-lg font-semibold flex items-center gap-1.5 opacity-75", tilt_wrap.className)}><RybbitLogo width={20} height={20} />- rybbit.com+ rybbit</Link></div></div>@@ -112,7 +112,9 @@ export function MainSection() {</Tooltip></div>)}- <ExportButton />+ <div className="hidden md:block">+ <ExportButton />+ </div><div className="pl-1"><BucketSelection /></div>diff --git a/client/src/app/[site]/performance/components/PerformanceChart.tsx b/client/src/app/[site]/performance/components/PerformanceChart.tsxindex 513d80c3e..19402629f 100644--- a/client/src/app/[site]/performance/components/PerformanceChart.tsx+++ b/client/src/app/[site]/performance/components/PerformanceChart.tsx@@ -198,7 +198,7 @@ export function PerformanceChart() {className={cn("text-lg font-semibold flex items-center gap-1.5 opacity-75", tilt_wrap.className)}><RybbitLogo width={20} height={20} />- rybbit.com+ rybbit</Link></div><div className="flex items-center space-x-4">