Skip to content

Commit 4df1bf9

Browse files
committed
fix(logs): trace view padding, section cutoff, keyboard visibility
- Tree pane now has top padding so the first row has breathing room under the header strip instead of sitting flush against the border. - DetailCodeSection dropped its wrapper `overflow-hidden`. Per CSS, a flex item with `overflow: hidden` resolves `min-height: auto` to `0`, so when Input and Output were both expanded the flex algorithm shrank each section below its content, cutting off rows. Without the clip, sections size to content and the surrounding pane's `overflow-y-auto` takes over. - Selected span row now scrolls into view on selection change, so arrow-key navigation always keeps the active row visible in the tree pane.
1 parent 63fdecc commit 4df1bf9

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/trace-view

apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/trace-view/trace-view.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ const TraceTreeRow = memo(function TraceTreeRow({
342342
aria-selected={isSelected}
343343
aria-expanded={canExpand ? isExpanded : undefined}
344344
aria-level={depth + 1}
345+
data-span-id={id}
345346
>
346347
<div
347348
className='flex min-w-0 items-center gap-1.5 pt-1 pr-3.5'
@@ -488,7 +489,7 @@ function DetailCodeSection({
488489
}, [activateSearch, closeContextMenu])
489490

490491
return (
491-
<div className='relative flex min-w-0 flex-col gap-1.5 overflow-hidden'>
492+
<div className='relative flex min-w-0 flex-col gap-1.5'>
492493
<div
493494
className='group flex cursor-pointer items-center justify-between'
494495
onClick={() => setIsOpen((v) => !v)}
@@ -830,6 +831,7 @@ const TraceDetailPane = memo(function TraceDetailPane({ span }: { span: TraceSpa
830831
* follow block-by-block and segment-by-segment what happened and why.
831832
*/
832833
export const TraceView = memo(function TraceView({ traceSpans }: TraceViewProps) {
834+
const treeRef = useRef<HTMLDivElement>(null)
833835
const [searchQuery, setSearchQuery] = useState('')
834836

835837
const { normalizedSpans, allIds, totalDuration, runStartMs, firstRootId, blockCount } =
@@ -950,6 +952,14 @@ export const TraceView = memo(function TraceView({ traceSpans }: TraceViewProps)
950952
return () => window.removeEventListener('keydown', handler)
951953
}, [flatList, selectedId, expandedNodes, handleToggleExpand])
952954

955+
useEffect(() => {
956+
if (!selectedId || !treeRef.current) return
957+
const row = treeRef.current.querySelector<HTMLElement>(
958+
`[data-span-id="${CSS.escape(selectedId)}"]`
959+
)
960+
row?.scrollIntoView({ block: 'nearest' })
961+
}, [selectedId])
962+
953963
if (!traceSpans || traceSpans.length === 0) {
954964
return (
955965
<div className='flex h-full items-center justify-center text-[var(--text-tertiary)] text-caption'>
@@ -1023,7 +1033,8 @@ export const TraceView = memo(function TraceView({ traceSpans }: TraceViewProps)
10231033
{/* Tree + detail split */}
10241034
<div className='flex min-h-0 flex-1'>
10251035
<div
1026-
className='flex flex-shrink-0 flex-col overflow-y-auto border-[var(--border)] border-r'
1036+
ref={treeRef}
1037+
className='flex flex-shrink-0 flex-col overflow-y-auto border-[var(--border)] border-r pt-2'
10271038
style={{ width: TREE_PANE_WIDTH }}
10281039
role='tree'
10291040
>

0 commit comments

Comments
 (0)