OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
fix(dashboard): fix previous data for time series
Carl-Gerhard Lindesvärdab2f7118807a
diff --git a/apps/dashboard/src/components/overview/overview-metrics.tsx b/apps/dashboard/src/components/overview/overview-metrics.tsxindex 10a8010f8..ad5d30579 100644--- a/apps/dashboard/src/components/overview/overview-metrics.tsx+++ b/apps/dashboard/src/components/overview/overview-metrics.tsx@@ -157,24 +157,24 @@ export default function OverviewMetrics({ projectId }: OverviewMetricsProps) {key={`prev_${activeMetric.key}`}type="linear"dataKey={`prev_${activeMetric.key}`}- stroke={'hsl(var(--foreground) / 0.2)'}+ stroke={'hsl(var(--foreground) / 0.1)'}strokeWidth={2}isAnimationActive={false}dot={data.length > 90? false: {- stroke: 'hsl(var(--foreground) / 0.2)',+ stroke: 'hsl(var(--foreground) / 0.1)',fill: 'hsl(var(--def-100))',strokeWidth: 1.5,- r: 3,+ r: 2,}}activeDot={{stroke: 'hsl(var(--foreground) / 0.2)',fill: 'hsl(var(--def-100))',- strokeWidth: 2,- r: 4,+ strokeWidth: 1.5,+ r: 3,}}/>diff --git a/packages/trpc/src/routers/overview.ts b/packages/trpc/src/routers/overview.tsindex 6b7bcf956..912c6058a 100644--- a/packages/trpc/src/routers/overview.ts+++ b/packages/trpc/src/routers/overview.ts@@ -92,7 +92,6 @@ export const overviewRouter = createTRPCRouter({input,true,)(overviewService.getMetrics.bind(overviewService));-return {metrics: {...current.metrics,@@ -104,8 +103,8 @@ export const overviewRouter = createTRPCRouter({prev_views_per_session: previous?.metrics.views_per_session || null,prev_total_sessions: previous?.metrics.total_sessions || null,},- series: current.series.map((item) => {- const prev = previous?.series.find((p) => p.date === item.date);+ series: current.series.map((item, index) => {+ const prev = previous?.series[index];return {...item,prev_bounce_rate: prev?.bounce_rate,