Skip to content

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

fix(trace-ui): make row label sticky for long cells (#9454)

Nimar5427d3f74f68
diff --git a/web/src/components/table/ValueCell.tsx b/web/src/components/table/ValueCell.tsx
index eae03ac33f..ec91c28fa7 100644
--- a/web/src/components/table/ValueCell.tsx
+++ b/web/src/components/table/ValueCell.tsx
@@ -7,7 +7,7 @@ import { Button } from "@/src/components/ui/button";
import { Copy, Check } from "lucide-react";
const MAX_STRING_LENGTH_FOR_LINK_DETECTION = 1500;
-const MAX_CELL_DISPLAY_CHARS = 2000;
+export const MAX_CELL_DISPLAY_CHARS = 2000;
const SMALL_ARRAY_THRESHOLD = 5;
const ARRAY_PREVIEW_ITEMS = 3;
const OBJECT_PREVIEW_KEYS = 2;
diff --git a/web/src/components/ui/PrettyJsonView.tsx b/web/src/components/ui/PrettyJsonView.tsx
index 3484dd90a3..891b073ce6 100644
--- a/web/src/components/ui/PrettyJsonView.tsx
+++ b/web/src/components/ui/PrettyJsonView.tsx
@@ -349,7 +349,10 @@ function JsonPrettyTable({
const buttonWidth = row.original.hasChildren ? BUTTON_WIDTH : 0;
const availableTextWidth = `calc(100% - ${indentationWidth + buttonWidth + CELL_PADDING_X + MARGIN_LEFT_1}px)`;
- return (
+ const valueLength = getValueStringLength(row.original.value);
+ const isLongValue = valueLength > MAX_CELL_DISPLAY_CHARS / 3; // already long if we don't truncate
+
+ const content = (
<div className="flex items-start break-words">
<div
className="flex flex-shrink-0 items-center justify-end"
@@ -386,6 +389,12 @@ function JsonPrettyTable({
</span>
</div>
);
+
+ return isLongValue ? (
+ <div className="sticky top-0 py-1">{content}</div>
+ ) : (
+ content
+ );
},
},
{
@@ -562,7 +571,7 @@ function JsonPrettyTable({
{row.getVisibleCells().map((cell) => (
<TableCell
key={cell.id}
- className="whitespace-normal px-2 py-1"
+ className="whitespace-normal px-2 py-1 align-top"
style={{ width: `${cell.column.columnDef.size}%` }}
>
{flexRender(cell.column.columnDef.cell, cell.getContext())}