Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Refactor time handling in useGetOverviewBucketed hook

Bill Yang516c735778dc
diff --git a/client/src/api/analytics/useGetOverviewBucketed.ts b/client/src/api/analytics/useGetOverviewBucketed.ts
index 0303acfe3..92afaf08d 100644
--- a/client/src/api/analytics/useGetOverviewBucketed.ts
+++ b/client/src/api/analytics/useGetOverviewBucketed.ts
@@ -47,19 +47,8 @@ export function useGetOverviewBucketed({
const timeToUse = periodTime === "previous" ? previousTime : baseTime;
const combinedFilters = [...globalFilters, ...dynamicFilters];
- // For "previous" periods in past-minutes mode, we need to modify the time object
- // to use doubled duration for the start and the original start as the end
- const timeForQuery =
- timeToUse.mode === "past-minutes" && periodTime === "previous"
- ? {
- ...timeToUse,
- pastMinutesStart: timeToUse.pastMinutesStart * 2,
- pastMinutesEnd: timeToUse.pastMinutesStart,
- }
- : timeToUse;
-
// Use getQueryParams utility to handle conditional logic
- const queryParams = getQueryParams(timeForQuery, {
+ const queryParams = getQueryParams(timeToUse, {
timeZone,
bucket,
filters: combinedFilters,
@@ -67,16 +56,16 @@ export function useGetOverviewBucketed({
// Generate appropriate query key based on whether we're using past minutes or regular time
const queryKey =
- timeForQuery.mode === "past-minutes"
+ timeToUse.mode === "past-minutes"
? [
"overview-bucketed-past-minutes",
- timeForQuery.pastMinutesStart,
- timeForQuery.pastMinutesEnd,
+ timeToUse.pastMinutesStart,
+ timeToUse.pastMinutesEnd,
site,
bucket,
combinedFilters,
]
- : ["overview-bucketed", timeForQuery, bucket, site, combinedFilters];
+ : ["overview-bucketed", timeToUse, bucket, site, combinedFilters];
return useQuery({
queryKey,
diff --git a/docs/src/content/roadmap.mdx b/docs/src/content/roadmap.mdx
index b9f027770..d105f24d4 100644
--- a/docs/src/content/roadmap.mdx
+++ b/docs/src/content/roadmap.mdx
@@ -9,11 +9,9 @@ Rybbit is a quickly growing project. We already have quite a few features, but t
- Custom reports/dashboards
- Stats API
- More tracking script/SDK integration guides
-- Better support for server-side event tracking
- Mobile app support
- Custom themes
- Revenue tracking
-- Web vitals tracking
- Email reports
- Traffic filters/bot blocking
- Traffic alerts