Skip to content

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

fix(traces): Prevent text overflow in trace view (#14489)

Ben Bachem7d5ba6a1ec0f
diff --git a/web/src/components/ui/CodeJsonViewer.tsx b/web/src/components/ui/CodeJsonViewer.tsx
index 93a4ba6cc6..0e57dba61c 100644
--- a/web/src/components/ui/CodeJsonViewer.tsx
+++ b/web/src/components/ui/CodeJsonViewer.tsx
@@ -91,7 +91,7 @@ export function JSONView(props: {
<>
<div
className={cn(
- "io-message-content flex gap-2 text-xs wrap-break-word whitespace-pre-wrap",
+ "io-message-content flex max-w-full min-w-0 gap-2 text-xs wrap-break-word whitespace-pre-wrap",
props.borderless ? "" : "p-2",
props.title === "assistant" || props.title === "Output"
? "bg-accent-light-green dark:border-accent-dark-green"
@@ -107,7 +107,7 @@ export function JSONView(props: {
<Skeleton className="h-3 w-3/4" />
) : promptReferenceProjectId && typeof parsedJson === "string" ? (
<code
- className="wrap-break-word whitespace-pre-wrap"
+ className="max-w-full min-w-0 wrap-break-word whitespace-pre-wrap"
dir="auto"
style={{ unicodeBidi: "plaintext" }}
>
@@ -115,6 +115,7 @@ export function JSONView(props: {
</code>
) : (
<div
+ className="max-w-full min-w-0 flex-1 overflow-hidden"
onClick={() => {
// If externally collapsed and user clicks to expand, sync the state
if (props.externalJsonCollapsed && props.onToggleCollapse) {
@@ -140,7 +141,7 @@ export function JSONView(props: {
displaySize={isCollapsed ? "collapsed" : "expanded"}
matchesURL={true}
customizeCopy={(node) => stringifyJsonNode(node)}
- className="w-full"
+ className="w-full max-w-full min-w-0"
/>
</div>
)}
@@ -167,7 +168,7 @@ export function JSONView(props: {
return (
<div
className={cn(
- "flex max-h-full min-h-0 flex-col",
+ "flex max-h-full min-h-0 max-w-full min-w-0 flex-col",
props.className,
props.scrollable ? "overflow-hidden" : "",
)}
@@ -199,8 +200,8 @@ export function JSONView(props: {
/>
) : null}
{props.scrollable ? (
- <div className="flex h-full min-h-0 overflow-hidden rounded-sm border">
- <div className="max-h-full min-h-0 w-full overflow-y-auto">
+ <div className="flex h-full min-h-0 max-w-full overflow-hidden rounded-sm border">
+ <div className="max-h-full min-h-0 w-full max-w-full min-w-0 overflow-y-auto">
{body}
</div>
</div>
@@ -268,7 +269,7 @@ export function CodeView(props: {
return (
<div
className={cn(
- "flex max-w-full flex-col",
+ "flex max-w-full min-w-0 flex-col",
props.className,
props.scrollable && "max-h-full min-h-0",
)}
@@ -290,7 +291,7 @@ export function CodeView(props: {
</>
<div
className={cn(
- "relative flex flex-col gap-2 rounded-md border",
+ "relative flex max-w-full min-w-0 flex-col gap-2 overflow-hidden rounded-md border",
props.scrollable ? "max-h-full min-h-0 overflow-hidden" : "",
)}
>
@@ -306,7 +307,7 @@ export function CodeView(props: {
)}
<code
className={cn(
- "relative flex-1 px-4 py-3 font-mono text-xs wrap-break-word whitespace-pre-wrap",
+ "relative max-w-full min-w-0 flex-1 px-4 py-3 font-mono text-xs wrap-break-word whitespace-pre-wrap",
isCollapsed ? `line-clamp-6` : "block",
props.scrollable ? "overflow-y-auto" : "",
)}