Skip to content

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

fix(trace): advanced json viewer improvements (#11162)

Michael Fröhlichfd96371603db
diff --git a/web/src/components/trace2/components/IOPreview/IOPreview.tsx b/web/src/components/trace2/components/IOPreview/IOPreview.tsx
index 918e960fec..7f3bb4c518 100644
--- a/web/src/components/trace2/components/IOPreview/IOPreview.tsx
+++ b/web/src/components/trace2/components/IOPreview/IOPreview.tsx
@@ -45,6 +45,9 @@ export interface IOPreviewProps extends ExpansionStateProps {
hideInput?: boolean;
currentView?: ViewMode;
setIsPrettyViewAvailable?: (value: boolean) => void;
+ // Whether to show metadata section in pretty view (default: false)
+ // JSON view always shows metadata
+ showMetadata?: boolean;
}
/**
@@ -80,6 +83,7 @@ export function IOPreview({
onInputExpansionChange,
onOutputExpansionChange,
setIsPrettyViewAvailable,
+ showMetadata = false,
}: IOPreviewProps) {
const capture = usePostHogClientCapture();
const [dismissedTraceViewNotifications, setDismissedTraceViewNotifications] =
@@ -158,49 +162,55 @@ export function IOPreview({
{selectedView === "json" ? (
<IOPreviewJSON {...sharedProps} />
) : (
- <IOPreviewPretty {...sharedProps} observationName={observationName} />
+ <IOPreviewPretty
+ {...sharedProps}
+ observationName={observationName}
+ showMetadata={showMetadata}
+ />
)}
{showEmptyState && (
- <div className="relative mx-2 flex flex-col items-start gap-2 rounded-lg border border-dashed p-4">
- <Button
- variant="ghost"
- size="sm"
- className="absolute right-1.5 top-1.5 h-5 w-5 p-0"
- onClick={() => {
- capture("notification:dismiss_notification", {
- notification_id: EMPTY_IO_ALERT_ID,
- });
- setDismissedTraceViewNotifications((prev) =>
- prev.includes(EMPTY_IO_ALERT_ID)
- ? prev
- : [...prev, EMPTY_IO_ALERT_ID],
- );
- }}
- title="Dismiss"
- >
- <X className="h-3.5 w-3.5" />
- </Button>
- <div className="flex w-full flex-row items-center gap-2 pr-6">
- <div className="flex h-8 w-8 items-center justify-center rounded-full bg-accent">
- <BookOpen className="h-4 w-4 text-muted-foreground" />
+ <div className="py-2">
+ <div className="relative mx-2 flex flex-col items-start gap-2 rounded-lg border border-dashed p-4">
+ <Button
+ variant="ghost"
+ size="sm"
+ className="absolute right-1.5 top-1.5 h-5 w-5 p-0"
+ onClick={() => {
+ capture("notification:dismiss_notification", {
+ notification_id: EMPTY_IO_ALERT_ID,
+ });
+ setDismissedTraceViewNotifications((prev) =>
+ prev.includes(EMPTY_IO_ALERT_ID)
+ ? prev
+ : [...prev, EMPTY_IO_ALERT_ID],
+ );
+ }}
+ title="Dismiss"
+ >
+ <X className="h-3.5 w-3.5" />
+ </Button>
+ <div className="flex w-full flex-row items-center gap-2 pr-6">
+ <div className="flex h-8 w-8 items-center justify-center rounded-full bg-accent">
+ <BookOpen className="h-4 w-4 text-muted-foreground" />
+ </div>
+ <h3 className="text-sm font-semibold">
+ Looks like this trace didn&apos;t receive an input or output.
+ </h3>
</div>
- <h3 className="text-sm font-semibold">
- Looks like this trace didn&apos;t receive an input or output.
- </h3>
+ <p className="max-w-sm text-sm text-muted-foreground">
+ Add it in your code to make debugging a lot easier.
+ </p>
+ <ActionButton
+ variant="outline"
+ size="sm"
+ href="https://langfuse.com/faq/all/empty-trace-input-and-output"
+ trackingEventName="notification:click_link"
+ trackingProps={{ notification_id: EMPTY_IO_ALERT_ID }}
+ >
+ View Documentation
+ </ActionButton>
</div>
- <p className="max-w-sm text-sm text-muted-foreground">
- Add it in your code to make debugging a lot easier.
- </p>
- <ActionButton
- variant="outline"
- size="sm"
- href="https://langfuse.com/faq/all/empty-trace-input-and-output"
- trackingEventName="notification:click_link"
- trackingProps={{ notification_id: EMPTY_IO_ALERT_ID }}
- >
- View Documentation
- </ActionButton>
</div>
)}
</>
diff --git a/web/src/components/trace2/components/IOPreview/IOPreviewJSON.tsx b/web/src/components/trace2/components/IOPreview/IOPreviewJSON.tsx
index 0f2cde1257..7a15c53181 100644
--- a/web/src/components/trace2/components/IOPreview/IOPreviewJSON.tsx
+++ b/web/src/components/trace2/components/IOPreview/IOPreviewJSON.tsx
@@ -1,10 +1,13 @@
-import { useState, useEffect } from "react";
+import { useState, useEffect, useCallback } from "react";
import { useTheme } from "next-themes";
import { type Prisma } from "@langfuse/shared";
import { AdvancedJsonSection } from "@/src/components/ui/AdvancedJsonSection/AdvancedJsonSection";
import { type MediaReturnType } from "@/src/features/media/validation";
import { type ExpansionStateProps } from "./IOPreview";
+const SECTION_PREFERENCE_KEY = "langfuse:io-section-preference";
+type SectionType = "input" | "output" | "metadata";
+
export interface IOPreviewJSONProps extends ExpansionStateProps {
input?: Prisma.JsonValue;
output?: Prisma.JsonValue;
@@ -55,45 +58,113 @@ export function IOPreviewJSON({
const outputBgColor = isDark ? "rgb(20, 30, 41)" : "rgb(248, 253, 250)"; // Dark blue-gray vs light green
const metadataBgColor = isDark ? "rgb(30, 20, 40)" : "rgb(253, 251, 254)"; // Dark purple vs light purple
- // Height constants for accordion layout
- // AdvancedJsonSection header has minHeight: 38px
- const HEADER_HEIGHT = 38; // px
- const BODY_MAX_HEIGHT = `calc(100% - ${HEADER_HEIGHT}px)`;
-
const showInput = !hideInput && !(hideIfNull && !parsedInput && !input);
const showOutput = !hideOutput && !(hideIfNull && !parsedOutput && !output);
const showMetadata = !(hideIfNull && !parsedMetadata && !metadata);
+ // Helper to check if data has content (renders rows in JSON viewer)
+ // null/undefined = 0 rows, everything else (including {} and []) = 1+ rows
+ const hasContent = (data: unknown): boolean => {
+ if (data === null || data === undefined) return false;
+ if (typeof data === "string") return data.trim().length > 0;
+ // Arrays and objects always count as content (even if empty)
+ // because they render as at least 1 row in the JSON viewer
+ return true;
+ };
+
+ // Check for non-empty content (prefer parsed data if available)
+ const outputHasContent = hasContent(parsedOutput ?? output);
+ const inputHasContent = hasContent(parsedInput ?? input);
+ const metadataHasContent = hasContent(parsedMetadata ?? metadata);
+
+ // Get user's preferred section from session storage
+ const getUserPreference = (): SectionType | null => {
+ if (typeof window === "undefined") return null;
+ const stored = sessionStorage.getItem(SECTION_PREFERENCE_KEY);
+ if (stored === "input" || stored === "output" || stored === "metadata") {
+ return stored;
+ }
+ return null;
+ };
+
+ // Check if user's preferred section is visible and has content
+ const userPreference = getUserPreference();
+ const userPreferenceIsVisible =
+ userPreference === "output"
+ ? showOutput
+ : userPreference === "input"
+ ? showInput
+ : userPreference === "metadata"
+ ? showMetadata
+ : false;
+ const userPreferenceHasContent =
+ userPreference === "output"
+ ? showOutput && outputHasContent
+ : userPreference === "input"
+ ? showInput && inputHasContent
+ : userPreference === "metadata"
+ ? showMetadata && metadataHasContent
+ : false;
+
// Accordion state: only one section can be expanded at a time
- // Default to first visible section
- const defaultExpanded = showInput
- ? "input"
- : showOutput
+ // Default expansion priority:
+ // 1. User preference (if visible AND has content)
+ // 2. Output > Input > Metadata (first with content)
+ // 3. User preference (if visible, even without content)
+ // 4. Output > Input > Metadata (first visible)
+ const defaultExpanded = userPreferenceHasContent
+ ? userPreference
+ : showOutput && outputHasContent
? "output"
- : showMetadata
- ? "metadata"
- : null;
+ : showInput && inputHasContent
+ ? "input"
+ : showMetadata && metadataHasContent
+ ? "metadata"
+ : userPreferenceIsVisible
+ ? userPreference
+ : showOutput
+ ? "output"
+ : showInput
+ ? "input"
+ : showMetadata
+ ? "metadata"
+ : null;
const [expandedSection, setExpandedSection] = useState<
"input" | "output" | "metadata" | null
>(defaultExpanded);
+ // Handle user manually selecting a section (stores preference)
+ const handleUserToggle = useCallback(
+ (section: SectionType) => {
+ const isExpanding = expandedSection !== section;
+ setExpandedSection(isExpanding ? section : null);
+
+ // Only store preference when user manually expands a section
+ if (isExpanding && typeof window !== "undefined") {
+ sessionStorage.setItem(SECTION_PREFERENCE_KEY, section);
+ }
+ },
+ [expandedSection],
+ );
+
// Ensure expandedSection is always valid (if current is hidden, switch to first visible)
+ // Priority: output > input > metadata
useEffect(() => {
- if (expandedSection === "input" && !showInput) {
+ if (expandedSection === "output" && !showOutput) {
setExpandedSection(
- showOutput ? "output" : showMetadata ? "metadata" : null,
+ showInput ? "input" : showMetadata ? "metadata" : null,
);
- } else if (expandedSection === "output" && !showOutput) {
+ } else if (expandedSection === "input" && !showInput) {
setExpandedSection(
- showInput ? "input" : showMetadata ? "metadata" : null,
+ showOutput ? "output" : showMetadata ? "metadata" : null,
);
} else if (expandedSection === "metadata" && !showMetadata) {
- setExpandedSection(showInput ? "input" : showOutput ? "output" : null);
+ setExpandedSection(showOutput ? "output" : showInput ? "input" : null);
}
}, [showInput, showOutput, showMetadata, expandedSection]);
return (
- <div className="flex h-full flex-col">
+ <div className="flex min-h-0 flex-1 flex-col">
{showInput && (
<AdvancedJsonSection
title="Input"
@@ -101,14 +172,11 @@ export function IOPreviewJSON({
data={input}
parsedData={parsedInput}
collapsed={expandedSection !== "input"}
- onToggleCollapse={() =>
- setExpandedSection(expandedSection === "input" ? null : "input")
- }
+ onToggleCollapse={() => handleUserToggle("input")}
isLoading={isLoading || isParsing}
media={media?.filter((m) => m.field === "input")}
enableSearch={true}
searchPlaceholder="Search input"
- maxHeight={BODY_MAX_HEIGHT}
hideIfNull={hideIfNull}
truncateStringsAt={100}
enableCopy={true}
@@ -124,14 +192,11 @@ export function IOPreviewJSON({
data={output}
parsedData={parsedOutput}
collapsed={expandedSection !== "output"}
- onToggleCollapse={() =>
- setExpandedSection(expandedSection === "output" ? null : "output")
- }
+ onToggleCollapse={() => handleUserToggle("output")}
isLoading={isLoading || isParsing}
media={media?.filter((m) => m.field === "output")}
enableSearch={true}
searchPlaceholder="Search output"
- maxHeight={BODY_MAX_HEIGHT}
hideIfNull={hideIfNull}
truncateStringsAt={100}
enableCopy={true}
@@ -147,16 +212,11 @@ export function IOPreviewJSON({
data={metadata}
parsedData={parsedMetadata}
collapsed={expandedSection !== "metadata"}
- onToggleCollapse={() =>
- setExpandedSection(
- expandedSection === "metadata" ? null : "metadata",
- )
- }
+ onToggleCollapse={() => handleUserToggle("metadata")}
isLoading={isLoading || isParsing}
media={media?.filter((m) => m.field === "metadata")}
enableSearch={true}
searchPlaceholder="Search metadata"
- maxHeight={BODY_MAX_HEIGHT}
hideIfNull={hideIfNull}
truncateStringsAt={100}
enableCopy={true}
diff --git a/web/src/components/trace2/components/IOPreview/IOPreviewPretty.tsx b/web/src/components/trace2/components/IOPreview/IOPreviewPretty.tsx
index 2525bb1c66..c91f369d19 100644
--- a/web/src/components/trace2/components/IOPreview/IOPreviewPretty.tsx
+++ b/web/src/components/trace2/components/IOPreview/IOPreviewPretty.tsx
@@ -46,7 +46,7 @@ function JsonInputOutputView({
const showOutput = !hideOutput && !(hideIfNull && !parsedOutput);
return (
- <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">
+ <div className="min-h-0 flex-1 [&_.io-message-content]:px-2 [&_.io-message-header]:px-2">
{showInput && (
<PrettyJsonView
title="Input"
@@ -90,6 +90,8 @@ export interface IOPreviewPrettyProps extends ExpansionStateProps {
media?: MediaReturnType[];
hideOutput?: boolean;
hideInput?: boolean;
+ // Whether to show metadata section (default: false)
+ showMetadata?: boolean;
}
/**
@@ -122,6 +124,7 @@ export function IOPreviewPretty({
outputExpansionState,
onInputExpansionChange,
onOutputExpansionChange,
+ showMetadata = false,
}: IOPreviewPrettyProps) {
// Use pre-parsed data if available (from useParsedObservation hook),
// otherwise parse with size/depth limits to prevent UI freeze
@@ -155,8 +158,6 @@ export function IOPreviewPretty({
// Determine if markdown is safe to render (content size check)
const shouldRenderMarkdown = useMemo(() => {
- const startTime = performance.now();
-
// Fast byte estimation without expensive JSON.stringify
// Estimate: count string lengths + rough object overhead
const estimateSize = (obj: unknown): number => {
@@ -188,20 +189,6 @@ export function IOPreviewPretty({
const shouldRender = totalSize <= MARKDOWN_RENDER_CHARACTER_LIMIT;
- const elapsed = performance.now() - startTime;
-
- // Performance logging
- console.log(
- `[IOPreviewPretty] shouldRenderMarkdown check:`,
- `\n - Input size: ${(inputSize / 1024).toFixed(2)}KB`,
- `\n - Output size: ${(outputSize / 1024).toFixed(2)}KB`,
- `\n - Messages size: ${(messagesSize / 1024).toFixed(2)}KB`,
- `\n - Total size: ${(totalSize / 1024).toFixed(2)}KB`,
- `\n - Limit: ${(MARKDOWN_RENDER_CHARACTER_LIMIT / 1024).toFixed(2)}KB`,
- `\n - Decision: ${shouldRender ? "RENDER MARKDOWN" : "SKIP MARKDOWN"}`,
- `\n - Time taken: ${elapsed.toFixed(2)}ms`,
- );
-
return shouldRender;
}, [parsedInput, parsedOutput, allMessages]);
@@ -229,8 +216,11 @@ export function IOPreviewPretty({
onOutputExpansionChange,
};
+ // Determine if metadata should be shown
+ const shouldShowMetadata = showMetadata && parsedMetadata !== undefined;
+
return (
- <>
+ <div className="min-h-0 flex-1">
<SectionToolDefinitions
tools={allTools}
toolCallCounts={toolCallCounts}
@@ -252,6 +242,20 @@ export function IOPreviewPretty({
) : (
<JsonInputOutputView {...jsonViewProps} />
)}
- </>
+
+ {/* Metadata Section */}
+ {shouldShowMetadata && (
+ <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">
+ <PrettyJsonView
+ title="Metadata"
+ json={parsedMetadata}
+ isLoading={isLoading}
+ isParsing={isParsing}
+ media={media?.filter((m) => m.field === "metadata") ?? []}
+ currentView="pretty"
+ />
+ </div>
+ )}
+ </div>
);
}
diff --git a/web/src/components/trace2/components/ObservationDetailView/ObservationDetailView.tsx b/web/src/components/trace2/components/ObservationDetailView/ObservationDetailView.tsx
index cd74b81a47..f8b8334978 100644
--- a/web/src/components/trace2/components/ObservationDetailView/ObservationDetailView.tsx
+++ b/web/src/components/trace2/components/ObservationDetailView/ObservationDetailView.tsx
@@ -313,7 +313,11 @@ export function ObservationDetailView({
value="preview"
className="mt-0 flex max-h-full min-h-0 w-full flex-1"
>
- <div className="flex w-full flex-col gap-2 overflow-y-auto">
+ <div
+ className={`flex min-h-0 w-full flex-1 flex-col ${
+ currentView === "pretty" ? "overflow-auto" : "overflow-hidden"
+ }`}
+ >
<IOPreview
key={observation.id}
observationName={observation.name ?? undefined}
@@ -334,6 +338,7 @@ export function ObservationDetailView({
onOutputExpansionChange={(exp) =>
setFieldExpansion("output", exp)
}
+ showMetadata
/>
</div>
</TabsBarContent>
diff --git a/web/src/components/trace2/components/TraceDetailView/TraceDetailView.tsx b/web/src/components/trace2/components/TraceDetailView/TraceDetailView.tsx
index ac64174848..845d855dbf 100644
--- a/web/src/components/trace2/components/TraceDetailView/TraceDetailView.tsx
+++ b/web/src/components/trace2/components/TraceDetailView/TraceDetailView.tsx
@@ -210,14 +210,24 @@ export function TraceDetailView({
value="preview"
className="mt-0 flex max-h-full min-h-0 w-full flex-1"
>
- <div className="flex w-full flex-col gap-2 overflow-y-auto">
- {/* Tags Section */}
- <div className="px-2 text-sm font-medium">Tags</div>
- <div className="flex flex-wrap gap-x-1 gap-y-1 px-2">
+ <div
+ className={`flex min-h-0 w-full flex-1 flex-col ${
+ currentView === "pretty" ? "overflow-auto" : "overflow-hidden"
+ }`}
+ >
+ {/* Tags Section - scrolls with content in pretty view, fixed in JSON view */}
+ <div
+ className={`px-2 pt-2 text-sm font-medium ${currentView === "json" ? "flex-shrink-0" : ""}`}
+ >
+ Tags
+ </div>
+ <div
+ className={`flex flex-wrap gap-x-1 gap-y-1 px-2 pb-2 ${currentView === "json" ? "flex-shrink-0" : ""}`}
+ >
<TagList selectedTags={trace.tags} isLoading={false} />
</div>
- {/* I/O Preview (includes metadata in JSON view) */}
+ {/* I/O Preview (includes metadata in both views) */}
<IOPreview
key={trace.id + "-io"}
input={trace.input ?? undefined}
@@ -236,6 +246,7 @@ export function TraceDetailView({
onOutputExpansionChange={(exp) =>
setFieldExpansion("output", exp)
}
+ showMetadata
/>
</div>
</TabsBarContent>
diff --git a/web/src/components/ui/AdvancedJsonSection/AdvancedJsonSection.tsx b/web/src/components/ui/AdvancedJsonSection/AdvancedJsonSection.tsx
index d82429045b..0f4c430c33 100644
--- a/web/src/components/ui/AdvancedJsonSection/AdvancedJsonSection.tsx
+++ b/web/src/components/ui/AdvancedJsonSection/AdvancedJsonSection.tsx
@@ -13,7 +13,6 @@
import { useState, useMemo, useCallback, useRef, useEffect } from "react";
import {
ChevronDown,
- ChevronRight,
ChevronUp,
WrapText,
Minus,
@@ -48,9 +47,6 @@ export interface AdvancedJsonSectionProps {
/** Callback when section collapse state changes */
onToggleCollapse?: () => void;
- /** Max height for the JSON viewer */
- maxHeight?: string;
-
/** Background color for the JSON viewer body */
backgroundColor?: string;
@@ -95,7 +91,6 @@ export function AdvancedJsonSection({
parsedData,
collapsed: controlledCollapsed,
onToggleCollapse,
- maxHeight = "500px",
backgroundColor,
headerBackgroundColor,
className,
@@ -265,7 +260,7 @@ export function AdvancedJsonSection({
return (
<div
- className={`border-b border-t ${className || ""}`}
+ className={`flex flex-col border-b border-t ${sectionCollapsed ? "" : "min-h-0 overflow-hidden"} ${className || ""}`}
style={{
backgroundColor: headerBackgroundColor || backgroundColor,
}}
@@ -281,19 +276,6 @@ export function AdvancedJsonSection({
<AdvancedJsonSectionHeader
title={
<div className="flex items-center gap-2">
- <button
- onClick={handleToggleSectionCollapse}
- className="inline-flex items-center justify-center rounded-sm p-0.5 transition-colors hover:bg-accent"
- aria-label={
- sectionCollapsed ? "Expand section" : "Collapse section"
- }
- >
- {sectionCollapsed ? (
- <ChevronRight className="h-4 w-4" />
- ) : (
- <ChevronDown className="h-4 w-4" />
- )}
- </button>
<span>{title}</span>
<span className="text-xs font-normal text-muted-foreground">
{totalRowCount} rows{isVirtualized ? " (virtualized)" : ""}
@@ -302,6 +284,8 @@ export function AdvancedJsonSection({
}
handleOnCopy={handleCopy}
backgroundColor={headerBackgroundColor}
+ onToggleCollapse={handleToggleSectionCollapse}
+ sectionCollapsed={sectionCollapsed}
controlButtons={
<>
{/* Search */}
@@ -418,12 +402,9 @@ export function AdvancedJsonSection({
{!sectionCollapsed && (
<div
ref={scrollContainerRef}
+ className="min-h-0 flex-1 overflow-auto"
style={{
- minHeight: "100px",
- maxHeight: maxHeight,
- overflow: "auto", // Single scroll container for both X and Y
backgroundColor: headerBackgroundColor || backgroundColor,
- height: "100%",
}}
>
{!hasData ? (
diff --git a/web/src/components/ui/AdvancedJsonSection/AdvancedJsonSectionHeader.tsx b/web/src/components/ui/AdvancedJsonSection/AdvancedJsonSectionHeader.tsx
index 8918046649..d287f551b7 100644
--- a/web/src/components/ui/AdvancedJsonSection/AdvancedJsonSectionHeader.tsx
+++ b/web/src/components/ui/AdvancedJsonSection/AdvancedJsonSectionHeader.tsx
@@ -10,7 +10,7 @@
import { useState } from "react";
import { Button } from "@/src/components/ui/button";
-import { Check, Copy } from "lucide-react";
+import { Check, ChevronDown, ChevronRight, Copy } from "lucide-react";
export interface AdvancedJsonSectionHeaderProps {
/** Section title (can be string or React node for custom rendering) */
@@ -27,6 +27,12 @@ export interface AdvancedJsonSectionHeaderProps {
/** Background color for the header */
backgroundColor?: string;
+
+ /** Callback when header title area is clicked (for expand/collapse) */
+ onToggleCollapse?: () => void;
+
+ /** Whether the section is currently collapsed */
+ sectionCollapsed?: boolean;
}
export function AdvancedJsonSectionHeader({
@@ -35,6 +41,8 @@ export function AdvancedJsonSectionHeader({
handleOnCopy,
controlButtons,
backgroundColor,
+ onToggleCollapse,
+ sectionCollapsed,
}: AdvancedJsonSectionHeaderProps) {
const [isCopied, setIsCopied] = useState(false);
@@ -43,7 +51,36 @@ export function AdvancedJsonSectionHeader({
className="io-message-header flex flex-row items-center justify-between px-1 py-1 text-sm font-medium capitalize transition-colors group-hover:bg-muted/80"
style={{ backgroundColor }}
>
- <div className="flex items-center gap-2">
+ <div
+ className="flex flex-1 cursor-pointer items-center gap-2"
+ onClick={onToggleCollapse}
+ role="button"
+ tabIndex={0}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" || e.key === " ") {
+ e.preventDefault();
+ onToggleCollapse?.();
+ }
+ }}
+ >
+ {onToggleCollapse && (
+ <button
+ onClick={(e) => {
+ e.stopPropagation();
+ onToggleCollapse();
+ }}
+ className="inline-flex items-center justify-center rounded-sm p-0.5 transition-colors hover:bg-accent"
+ aria-label={
+ sectionCollapsed ? "Expand section" : "Collapse section"
+ }
+ >
+ {sectionCollapsed ? (
+ <ChevronRight className="h-4 w-4" />
+ ) : (
+ <ChevronDown className="h-4 w-4" />
+ )}
+ </button>
+ )}
{titleIcon}
{title}
</div>
diff --git a/web/src/components/ui/AdvancedJsonViewer/AdvancedJsonViewer.tsx b/web/src/components/ui/AdvancedJsonViewer/AdvancedJsonViewer.tsx
index 9af4f4e10d..d9bef394b0 100644
--- a/web/src/components/ui/AdvancedJsonViewer/AdvancedJsonViewer.tsx
+++ b/web/src/components/ui/AdvancedJsonViewer/AdvancedJsonViewer.tsx
@@ -44,7 +44,7 @@ export function AdvancedJsonViewer({
matchCounts,
showLineNumbers = false,
enableCopy = true,
- stringWrapMode = "truncate",
+ stringWrapMode = "wrap",
onStringWrapModeChange: _onStringWrapModeChange,
truncateStringsAt = 100,
className,
diff --git a/web/src/components/ui/AdvancedJsonViewer/SimpleJsonViewer.tsx b/web/src/components/ui/AdvancedJsonViewer/SimpleJsonViewer.tsx
index bc252556e2..771cdb7465 100644
--- a/web/src/components/ui/AdvancedJsonViewer/SimpleJsonViewer.tsx
+++ b/web/src/components/ui/AdvancedJsonViewer/SimpleJsonViewer.tsx
@@ -42,7 +42,7 @@ export const SimpleJsonViewer = memo(function SimpleJsonViewer({
matchCounts,
showLineNumbers = false,
enableCopy = false,
- stringWrapMode = "truncate",
+ stringWrapMode = "wrap",
truncateStringsAt = null,
onToggleExpansion,
className,
diff --git a/web/src/components/ui/AdvancedJsonViewer/VirtualizedJsonViewer.tsx b/web/src/components/ui/AdvancedJsonViewer/VirtualizedJsonViewer.tsx
index a677bed909..7488d377f6 100644
--- a/web/src/components/ui/AdvancedJsonViewer/VirtualizedJsonViewer.tsx
+++ b/web/src/components/ui/AdvancedJsonViewer/VirtualizedJsonViewer.tsx
@@ -42,7 +42,7 @@ export const VirtualizedJsonViewer = memo(function VirtualizedJsonViewer({
matchCounts,
showLineNumbers = false,
enableCopy = false,
- stringWrapMode = "truncate",
+ stringWrapMode = "wrap",
truncateStringsAt = null,
onToggleExpansion,
className,
diff --git a/web/src/components/ui/AdvancedJsonViewer/components/JsonRowFixed.tsx b/web/src/components/ui/AdvancedJsonViewer/components/JsonRowFixed.tsx
index aa422918e0..402a51de02 100644
--- a/web/src/components/ui/AdvancedJsonViewer/components/JsonRowFixed.tsx
+++ b/web/src/components/ui/AdvancedJsonViewer/components/JsonRowFixed.tsx
@@ -32,7 +32,7 @@ export function JsonRowFixed({
searchMatch,
isCurrentMatch = false,
onToggleExpansion,
- stringWrapMode = "truncate",
+ stringWrapMode = "wrap",
className,
isToggling = false,
}: JsonRowFixedProps) {
diff --git a/web/src/components/ui/AdvancedJsonViewer/components/JsonRowScrollable.tsx b/web/src/components/ui/AdvancedJsonViewer/components/JsonRowScrollable.tsx
index f8c3df7637..0457d030bd 100644
--- a/web/src/components/ui/AdvancedJsonViewer/components/JsonRowScrollable.tsx
+++ b/web/src/components/ui/AdvancedJsonViewer/components/JsonRowScrollable.tsx
@@ -26,7 +26,7 @@ export interface JsonRowScrollableProps {
export function JsonRowScrollable({
row,
theme,
- stringWrapMode = "truncate",
+ stringWrapMode = "wrap",
truncateStringsAt = null,
matchCount,
currentMatchIndexInRow,
diff --git a/web/src/components/ui/AdvancedJsonViewer/components/JsonValue.tsx b/web/src/components/ui/AdvancedJsonViewer/components/JsonValue.tsx
index cfeb22f20a..f24a720d01 100644
--- a/web/src/components/ui/AdvancedJsonViewer/components/JsonValue.tsx
+++ b/web/src/components/ui/AdvancedJsonViewer/components/JsonValue.tsx
@@ -16,7 +16,7 @@ export function JsonValue({
theme,
isExpandable = false,
childCount: _childCount,
- stringWrapMode = "truncate",
+ stringWrapMode = "wrap",
truncateStringsAt = null,
highlightStart,
highlightEnd,
diff --git a/web/src/components/ui/AdvancedJsonViewer/hooks/useJsonTheme.ts b/web/src/components/ui/AdvancedJsonViewer/hooks/useJsonTheme.ts
index 4eeaf5bd4d..d309b60d0e 100644
--- a/web/src/components/ui/AdvancedJsonViewer/hooks/useJsonTheme.ts
+++ b/web/src/components/ui/AdvancedJsonViewer/hooks/useJsonTheme.ts
@@ -11,12 +11,13 @@ import { type JSONTheme, type PartialJSONTheme } from "../types";
/**
* Default light theme
+ * Colors inspired by GitHub's syntax highlighting
*/
const defaultLightTheme: JSONTheme = {
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
- keyColor: "hsl(var(--foreground))",
- stringColor: "hsl(var(--foreground))",
+ keyColor: "#0550ae", // Blue for keys (GitHub property color)
+ stringColor: "#0a3069", // Dark blue for strings (GitHub string color)
numberColor: "#0550ae", // Blue for numbers
booleanColor: "#0550ae", // Blue for booleans
nullColor: "hsl(var(--muted-foreground))",
@@ -35,11 +36,14 @@ const defaultLightTheme: JSONTheme = {
/**
* Default dark theme
+ * Colors inspired by GitHub's dark mode syntax highlighting
*/
const defaultDarkTheme: JSONTheme = {
...defaultLightTheme,
- numberColor: "#539bf5", // Lighter blue for dark mode
- booleanColor: "#539bf5",
+ keyColor: "#79c0ff", // Light blue for keys (GitHub dark property color)
+ stringColor: "#a5d6ff", // Lighter blue for strings (GitHub dark string color)
+ numberColor: "#79c0ff", // Light blue for numbers
+ booleanColor: "#79c0ff", // Light blue for booleans
searchMatchBackground: "rgba(255, 255, 0, 0.2)",
searchCurrentBackground: "rgba(255, 255, 0, 0.35)",
};
diff --git a/web/src/components/ui/AdvancedJsonViewer/hooks/useJsonViewPreferences.ts b/web/src/components/ui/AdvancedJsonViewer/hooks/useJsonViewPreferences.ts
index 56c4f57f72..8b64f69b13 100644
--- a/web/src/components/ui/AdvancedJsonViewer/hooks/useJsonViewPreferences.ts
+++ b/web/src/components/ui/AdvancedJsonViewer/hooks/useJsonViewPreferences.ts
@@ -14,7 +14,7 @@ export interface JsonViewPreferences {
}
const DEFAULT_PREFERENCES: JsonViewPreferences = {
- stringWrapMode: "truncate",
+ stringWrapMode: "wrap",
};
/**
diff --git a/web/src/hooks/useParsedTrace.ts b/web/src/hooks/useParsedTrace.ts
index 075285bc7c..f6946ecfaa 100644
--- a/web/src/hooks/useParsedTrace.ts
+++ b/web/src/hooks/useParsedTrace.ts
@@ -116,8 +116,6 @@ async function parseTraceData(
return new Promise<ParsedData>((resolve, reject) => {
const parseId = `${Date.now()}-${Math.random()}`;
- console.log(`[useParsedTrace] Starting background parse ${parseId}`);
-
pendingCallbacks.set(parseId, (result) => {
pendingCallbacks.delete(parseId);
@@ -127,10 +125,6 @@ async function parseTraceData(
return;
}
- console.log(
- `[useParsedTrace] Parse completed in ${result.parseTime?.toFixed(2)}ms`,
- );
-
resolve({
input: result.parsedInput,
output: result.parsedOutput,