Skip to content

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

fix(trace-ui): panel min width (#9793)

Nimar4904478c9722
diff --git a/web/src/components/trace/hooks/usePanelState.ts b/web/src/components/trace/hooks/usePanelState.ts
index cf33099906..3193664b43 100644
--- a/web/src/components/trace/hooks/usePanelState.ts
+++ b/web/src/components/trace/hooks/usePanelState.ts
@@ -9,7 +9,7 @@ export function usePanelState(
panelGroupId: string,
viewType: "timeline" | "tree",
) {
- const MIN_WIDTH_PX = 355;
+ const MIN_WIDTH_PX = 255;
const MAX_TREE_WIDTH_PX = 700;
const [panelState, setPanelState] = useState<PanelState>({
diff --git a/web/src/components/trace/index.tsx b/web/src/components/trace/index.tsx
index 52a2f63f44..7454fe22cb 100644
--- a/web/src/components/trace/index.tsx
+++ b/web/src/components/trace/index.tsx
@@ -142,6 +142,18 @@ export function Trace(props: {
// Derive collapsed state from actual panel size (single source of truth = autoSaveId)
// This avoids cross-tab sync issues from storing collapsed state separately
const [isTreePanelCollapsed, setIsTreePanelCollapsed] = useState(false);
+
+ // Sync initial collapsed state from actual panel size on mount
+ useEffect(() => {
+ if (treePanelRef.current) {
+ const currentSize = treePanelRef.current.getSize();
+ const collapsed = currentSize <= 5;
+ if (collapsed !== isTreePanelCollapsed) {
+ setIsTreePanelCollapsed(collapsed);
+ }
+ }
+ }, []);
+
const isAuthenticatedAndProjectMember = useIsAuthenticatedAndProjectMember(
props.projectId,
);
@@ -564,7 +576,6 @@ export function Trace(props: {
collapsedSize={3}
onResize={(size) => {
// Derive collapsed state from actual panel size
- // This is the ONLY source of truth (autoSaveId handles persistence)
const collapsed = size <= 5;
if (collapsed !== isTreePanelCollapsed) {
setIsTreePanelCollapsed(collapsed);
@@ -578,7 +589,8 @@ export function Trace(props: {
variant="ghost"
size="icon"
onClick={() => {
- treePanelRef.current?.resize(TREE_DEFAULT_WIDTH);
+ // Use minSize as the smallest legal value we can expand to
+ treePanelRef.current?.resize(panelState.minSize);
capture("trace_detail:tree_panel_toggle", {
collapsed: false,
});
@@ -742,7 +754,7 @@ export function Trace(props: {
size="icon"
onClick={() => {
if (isTreePanelCollapsed) {
- treePanelRef.current?.resize(TREE_DEFAULT_WIDTH);
+ treePanelRef.current?.resize(panelState.minSize);
} else {
treePanelRef.current?.collapse();
}