fix bugs in report editor, mainly re-render issues with same keys

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-04-27 21:14:46 +02:00
parent 64b2e84aeb
commit c3815bf6ab
9 changed files with 19 additions and 13 deletions

View File

@@ -631,5 +631,9 @@ export async function getSeriesFromEvents(input: IChartInput) {
)
).flat();
return withFormula(input, series);
try {
return withFormula(input, series);
} catch (e) {
return series;
}
}

View File

@@ -2,7 +2,7 @@ import { flatten, map, pipe, prop, sort, uniq } from 'ramda';
import { escape } from 'sqlstring';
import { z } from 'zod';
import { average, max, min, round, sum } from '@openpanel/common';
import { average, max, min, round, slug, sum } from '@openpanel/common';
import { chQuery, createSqlBuilder } from '@openpanel/db';
import { zChartInput } from '@openpanel/validation';
import type { IChartEvent, IChartInput } from '@openpanel/validation';
@@ -36,6 +36,7 @@ interface Metrics {
}
export interface IChartSerie {
id: string;
name: string;
event: IChartEvent;
metrics: Metrics;
@@ -217,6 +218,7 @@ export const chartRouter = createTRPCRouter({
};
return {
id: slug(serie.name), // TODO: Remove this (temporary fix for the frontend
name: serie.name,
event: {
...serie.event,