Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(dataset-runs): during loading states render skeletons for charts (#9258)

marliessophiebc178010c109
diff --git a/web/src/features/datasets/components/DatasetRunsTable.tsx b/web/src/features/datasets/components/DatasetRunsTable.tsx
index f3b05d2a13..5ed778d739 100644
--- a/web/src/features/datasets/components/DatasetRunsTable.tsx
+++ b/web/src/features/datasets/components/DatasetRunsTable.tsx
@@ -59,9 +59,10 @@ import { useScoreColumns } from "@/src/features/scores/hooks/useScoreColumns";
import {
scoreFilters,
addPrefixToScoreKeys,
- getScoreDataTypeIcon,
convertScoreColumnsToAnalyticsData,
} from "@/src/features/scores/lib/scoreColumns";
+import { getScoreLabelFromKey } from "@/src/features/scores/lib/aggregateScores";
+import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";
export type DatasetRunRowData = {
id: string;
@@ -601,9 +602,7 @@ export function DatasetRunsTable(props: {
);
// Check if we have charts to display
- const hasCharts =
- Boolean(props.selectedMetrics.length) &&
- Boolean(runAggregatedMetrics?.size);
+ const hasCharts = Boolean(props.selectedMetrics.length);
return (
<>
@@ -623,6 +622,24 @@ export function DatasetRunsTable(props: {
<div className="h-full w-full overflow-x-auto overflow-y-auto p-3">
<div className="flex h-full w-full gap-4">
{props.selectedMetrics.map((key) => {
+ const title =
+ RESOURCE_METRICS.find((metric) => metric.key === key)
+ ?.label ?? getScoreLabelFromKey(key);
+
+ if (!Boolean(runAggregatedMetrics?.size)) {
+ return (
+ <div
+ key={key}
+ className="flex h-full min-w-80 max-w-full flex-col gap-2"
+ >
+ <span className="shrink-0 text-sm font-medium">
+ {title}
+ </span>
+ <NoDataOrLoading isLoading={true} />
+ </div>
+ );
+ }
+
const adapter = new CompareViewAdapter(
runAggregatedMetrics,
key,
@@ -636,11 +653,7 @@ export function DatasetRunsTable(props: {
<TimeseriesChart
chartData={chartData}
chartLabels={chartLabels}
- title={
- RESOURCE_METRICS.find(
- (metric) => metric.key === key,
- )?.label ?? key
- }
+ title={title}
type="numeric"
maxFractionDigits={
RESOURCE_METRICS.find(
@@ -656,7 +669,7 @@ export function DatasetRunsTable(props: {
<TimeseriesChart
chartData={chartData}
chartLabels={chartLabels}
- title={`${getScoreDataTypeIcon(scoreData.dataType)} ${scoreData.name} (${scoreData.source.toLowerCase()})`}
+ title={title}
type={
isNumericDataType(scoreData.dataType)
? "numeric"
diff --git a/web/src/features/scores/lib/aggregateScores.ts b/web/src/features/scores/lib/aggregateScores.ts
index 8ec3845663..14ec06b42c 100644
--- a/web/src/features/scores/lib/aggregateScores.ts
+++ b/web/src/features/scores/lib/aggregateScores.ts
@@ -1,3 +1,4 @@
+import { getScoreDataTypeIcon } from "@/src/features/scores/lib/scoreColumns";
import {
type ScoreAggregate,
type ScoreSimplified,
@@ -35,6 +36,11 @@ export const decomposeAggregateScoreKey = (
};
};
+export const getScoreLabelFromKey = (key: string): string => {
+ const { name, source, dataType } = decomposeAggregateScoreKey(key);
+ return `${getScoreDataTypeIcon(dataType)} ${name} (${source.toLowerCase()})`;
+};
+
type ScoreToAggregate = (APIScoreV2 | ScoreSimplified) & {
hasMetadata?: boolean;
};