fix(dashboard): fix previous data for time series
This commit is contained in:
@@ -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,
|
||||
}}
|
||||
/>
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user