Skip to content

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

chore(ui-dashboard): save selected score graphs in the dashboard to `localStorage` (project-bound) (#5029)

marliessophie3b205b45ce8e
diff --git a/web/src/components/table/use-cases/score-configs.tsx b/web/src/components/table/use-cases/score-configs.tsx
index 0781cc384a..936b5bbba8 100644
--- a/web/src/components/table/use-cases/score-configs.tsx
+++ b/web/src/components/table/use-cases/score-configs.tsx
@@ -249,7 +249,7 @@ export function ScoreConfigsTable({ projectId }: { projectId: string }) {
rowHeight={rowHeight}
setRowHeight={setRowHeight}
/>
- <Card className="mb-4 flex max-h-[calc(100dvh-30rem)] flex-col overflow-hidden">
+ <Card className="mb-4 flex max-h-[60dvh] flex-col overflow-hidden">
<DataTable
columns={columns}
data={
diff --git a/web/src/features/dashboard/components/score-analytics/ScoreAnalytics.tsx b/web/src/features/dashboard/components/score-analytics/ScoreAnalytics.tsx
index a9d95c35a3..9ff232d534 100644
--- a/web/src/features/dashboard/components/score-analytics/ScoreAnalytics.tsx
+++ b/web/src/features/dashboard/components/score-analytics/ScoreAnalytics.tsx
@@ -4,7 +4,7 @@ import { DashboardCard } from "@/src/features/dashboard/components/cards/Dashboa
import { type FilterState } from "@langfuse/shared";
import { type DashboardDateRangeAggregationOption } from "@/src/utils/date-range-utils";
import { MultiSelectKeyValues } from "@/src/features/scores/components/multi-select-key-values";
-import React, { useMemo, useState } from "react";
+import React, { useMemo } from "react";
import { Separator } from "@/src/components/ui/separator";
import {
isBooleanDataType,
@@ -20,6 +20,7 @@ import DocPopup from "@/src/components/layouts/doc-popup";
import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";
import { Flex, Text } from "@tremor/react";
import { useClickhouse } from "@/src/components/layouts/ClickhouseAdminToggle";
+import useLocalStorage from "@/src/components/useLocalStorage";
export function ScoreAnalytics(props: {
className?: string;
@@ -27,9 +28,12 @@ export function ScoreAnalytics(props: {
globalFilterState: FilterState;
projectId: string;
}) {
- const [selectedDashboardScoreKeys, setSelectedDashboardScoreKeys] = useState<
- string[]
- >([]);
+ // Stale score selections in localStorage are ignored as we only show scores that exist in scoreAnalyticsOptions
+ const [selectedDashboardScoreKeys, setSelectedDashboardScoreKeys] =
+ useLocalStorage<string[]>(
+ `selectedDashboardScoreKeys-${props.projectId}`,
+ [],
+ );
const scoreKeysAndProps = api.scores.getScoreKeysAndProps.useQuery(
{