🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(trace-detail): collapse all button ignoring root node (#8581)
Leo Weigand251741aacbcd
diff --git a/web/src/components/table/peek/peek-dataset-compare-detail.tsx b/web/src/components/table/peek/peek-dataset-compare-detail.tsxindex c474598b1f..b139c4f4be 100644--- a/web/src/components/table/peek/peek-dataset-compare-detail.tsx+++ b/web/src/components/table/peek/peek-dataset-compare-detail.tsx@@ -74,8 +74,8 @@ export const PeekDatasetCompareDetail = ({}, []);const handleSetCurrentObservationId = (id?: string) => {- if (id && traceId && !id.startsWith("trace-")) {- // Only open observations in new tabs, not the trace root (which has trace- prefix)+ if (id && traceId) {+ // Only open observations in new tabs; root selection passes undefinedconst pathname = `/project/${projectId}/traces/${encodeURIComponent(traceId)}?observation=${encodeURIComponent(id)}`;const pathnameWithBasePath = `${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}${pathname}`;window.open(pathnameWithBasePath, "_blank", "noopener noreferrer");diff --git a/web/src/components/trace/index.tsx b/web/src/components/trace/index.tsxindex 8fb449ea95..37c1433c8a 100644--- a/web/src/components/trace/index.tsx+++ b/web/src/components/trace/index.tsx@@ -289,10 +289,11 @@ export function Trace(props: {</Button>) : ((() => {- // Check if anything is expanded by seeing if the trace is collapsed- const isEverythingCollapsed = collapsedNodes.includes(- props.trace.id,- );+ // Use the same root id format as the tree (see buildTraceTree)+ const traceRootId = `trace-${props.trace.id}`;+ // Check if everything is collapsed by seeing if the trace root is collapsed+ const isEverythingCollapsed =+ collapsedNodes.includes(traceRootId);return (<Button@@ -300,12 +301,12 @@ export function Trace(props: {if (isEverythingCollapsed) {expandAll();} else {- // Collapse all observations AND the trace+ // Collapse all observations AND the trace rootconst allObservationIds =props.observations.map((o) => o.id);setCollapsedNodes([...allObservationIds,- props.trace.id,+ traceRootId,]);}}}