Skip to content

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

fix(trace): restore timeline gutter touch-scrolling and trim oversized list overscan (LFE-10548) (#14600)

Nikita Kabardinb6ec8c29179e
diff --git a/web/src/components/trace/components/TraceSearchList.tsx b/web/src/components/trace/components/TraceSearchList.tsx
index 78970355b9..007f813075 100644
--- a/web/src/components/trace/components/TraceSearchList.tsx
+++ b/web/src/components/trace/components/TraceSearchList.tsx
@@ -74,7 +74,6 @@ export function TraceSearchList() {
onSelectItem={handleSelectItem}
getItemId={(item) => item.node.id}
estimatedItemSize={48}
- overscan={500}
renderItem={({ item, isSelected, onSelect }) => (
<TraceSearchListItem
item={item}
diff --git a/web/src/components/trace/components/TraceTimeline/index.tsx b/web/src/components/trace/components/TraceTimeline/index.tsx
index 978eeb1882..3f05791143 100644
--- a/web/src/components/trace/components/TraceTimeline/index.tsx
+++ b/web/src/components/trace/components/TraceTimeline/index.tsx
@@ -4,8 +4,8 @@
* Two panes, side by side, sharing the virtualized rows:
* - Gutter pane (fixed, resizable): the indented name tree. It never scrolls
* itself — its content is a one-way translateY projection of the chart's
- * vertical scroll, so the two panes can't drift; wheeling over it drives the
- * chart.
+ * vertical scroll, so the two panes can't drift; wheeling or touch-dragging
+ * over it drives the chart.
* - Chart pane (flex-1): the gantt bars. Owns the only scrollbars (horizontal
* and vertical) and is the virtualizer's scroll element.
*
@@ -204,6 +204,46 @@ export function TraceTimeline() {
chart.scrollTop += e.deltaY * unit;
}, []);
+ // Touch (and pen/mouse drag) over the gutter scrolls it too. WheelEvents are
+ // never synthesized on touch, so on touch-capable screens that render this
+ // desktop layout the wheel handler alone leaves the gutter stuck. Pointer
+ // events cover touch + pen + mouse uniformly: we drag-scroll the chart (move
+ // a finger up → content scrolls up, so scrollTop -= dy), and the chart
+ // projects straight back onto the gutter via handleChartScroll — same
+ // pixel-locked path as the wheel, so the two panes still can't drift.
+ const dragRef = useRef<{ pointerId: number; lastY: number } | null>(null);
+ const handleGutterPointerDown = useCallback((e: React.PointerEvent) => {
+ // Only drag-scroll for touch/pen. Leave the mouse to clicks (rows are
+ // clickable) and the wheel; a mouse drag here would otherwise hijack
+ // text selection / row clicks.
+ if (e.pointerType === "mouse") return;
+ const chart = chartRef.current;
+ if (!chart) return;
+ dragRef.current = { pointerId: e.pointerId, lastY: e.clientY };
+ e.currentTarget.setPointerCapture(e.pointerId);
+ }, []);
+ const handleGutterPointerMove = useCallback((e: React.PointerEvent) => {
+ const drag = dragRef.current;
+ const chart = chartRef.current;
+ if (!drag || drag.pointerId !== e.pointerId || !chart) return;
+ // Clamp-aware: only consume the scroll delta the browser actually applied.
+ // The browser clamps scrollTop to [0, maxScroll], so advancing lastY to
+ // e.clientY unconditionally would record finger motion past a boundary that
+ // scrollTop discarded; a later direction reversal would then resurface as
+ // phantom scroll with zero net finger travel. Advancing lastY by only the
+ // applied delta keeps over-the-boundary motion from leaking back in.
+ const prev = chart.scrollTop;
+ chart.scrollTop -= e.clientY - drag.lastY;
+ drag.lastY += prev - chart.scrollTop;
+ }, []);
+ const handleGutterPointerEnd = useCallback((e: React.PointerEvent) => {
+ if (dragRef.current?.pointerId !== e.pointerId) return;
+ dragRef.current = null;
+ if (e.currentTarget.hasPointerCapture(e.pointerId)) {
+ e.currentTarget.releasePointerCapture(e.pointerId);
+ }
+ }, []);
+
// Parent totals for heatmap coloring (aggregate across all roots).
const parentTotalCost = useMemo(() => {
return roots.reduce(
@@ -365,10 +405,16 @@ export function TraceTimeline() {
>
{/* Gutter pane — a one-way projection of the chart's vertical scroll
(translateY), never its own scroll container, so it stays locked to
- the chart. Wheeling over it drives the chart. */}
+ the chart. Wheeling or touch-dragging over it drives the chart.
+ touchAction:none stops the browser claiming the vertical pan gesture
+ (there's nothing to pan here) so our pointer-drag handlers fire. */}
<div
onWheel={handleGutterWheel}
- className="shrink-0 overflow-hidden"
+ onPointerDown={handleGutterPointerDown}
+ onPointerMove={handleGutterPointerMove}
+ onPointerUp={handleGutterPointerEnd}
+ onPointerCancel={handleGutterPointerEnd}
+ className="shrink-0 touch-none overflow-hidden"
style={{ width: `${gutterWidth}px` }}
>
<div
diff --git a/web/src/components/trace/components/_layout/TraceLayoutDesktop.tsx b/web/src/components/trace/components/_layout/TraceLayoutDesktop.tsx
index 2ddddcbe08..3c86760b05 100644
--- a/web/src/components/trace/components/_layout/TraceLayoutDesktop.tsx
+++ b/web/src/components/trace/components/_layout/TraceLayoutDesktop.tsx
@@ -211,9 +211,10 @@ export function TraceLayoutDesktop({ children }: { children: ReactNode }) {
>
{children}
</Group>
- {/* When the detail panel is collapsed, the navigation header surfaces a
- "show detail panel" button at its right edge (TracePanelNavigationHeader)
- — no floating edge tab. */}
+ {/* When the detail panel is collapsed it renders its own collapsed rail
+ with a "Show detail panel" button (see DetailPanel below) — the
+ navigation header carries no re-open button, and there's no floating
+ edge tab. */}
</div>
</LayoutContext.Provider>
);
diff --git a/web/src/components/trace/components/_layout/TracePanelNavigationHeader.tsx b/web/src/components/trace/components/_layout/TracePanelNavigationHeader.tsx
index 6c938bb939..cc69aca2fe 100644
--- a/web/src/components/trace/components/_layout/TracePanelNavigationHeader.tsx
+++ b/web/src/components/trace/components/_layout/TracePanelNavigationHeader.tsx
@@ -269,9 +269,10 @@ function TracePanelNavigationHeaderExpanded({
isTimelineView={isTimelineView}
onSelect={(timeline) => setViewMode(timeline ? "timeline" : null)}
/>
- {/* When the detail panel is closed it shows its own collapsed rail +
- expand button on the right edge (mirrors the navigation panel), so
- the header needs no re-open button — see TraceLayoutDesktop. */}
+ {/* When the detail panel is closed it shows its own collapsed rail
+ with a "Show detail panel" button on the right edge (DetailPanel in
+ TraceLayoutDesktop, mirroring the navigation panel's rail), so the
+ header needs no re-open button of its own. */}
</div>
</div>
</Command>
diff --git a/web/src/components/trace/components/_shared/VirtualizedList.tsx b/web/src/components/trace/components/_shared/VirtualizedList.tsx
index 2d5f9d8647..062e9406e3 100644
--- a/web/src/components/trace/components/_shared/VirtualizedList.tsx
+++ b/web/src/components/trace/components/_shared/VirtualizedList.tsx
@@ -30,7 +30,10 @@ export function VirtualizedList<T>({
onSelectItem,
getItemId,
estimatedItemSize = 48,
- overscan = 500,
+ // overscan is a ROW COUNT, not pixels: keep it small so a long list mounts
+ // only a few dozen extra rows per scroll step instead of ~1000 (the old "500"
+ // mistook it for pixels). ~16 rows ≈ half a viewport of headroom.
+ overscan = 16,
}: VirtualizedListProps<T>) {
const parentRef = useRef<HTMLDivElement>(null);
diff --git a/web/src/components/trace/components/_shared/VirtualizedTree.tsx b/web/src/components/trace/components/_shared/VirtualizedTree.tsx
index 0caac4947e..4521bd053e 100644
--- a/web/src/components/trace/components/_shared/VirtualizedTree.tsx
+++ b/web/src/components/trace/components/_shared/VirtualizedTree.tsx
@@ -39,7 +39,10 @@ export function VirtualizedTree<T extends { id: string; children: T[] }>({
onToggleCollapse,
onSelectNode,
estimateSize,
- overscan = 500,
+ // overscan is a ROW COUNT, not pixels: keep it small so a long tree mounts
+ // only a few dozen extra rows per scroll step instead of ~1000 (the old "500"
+ // mistook it for pixels). ~16 rows ≈ half a viewport of headroom.
+ overscan = 16,
defaultRowHeight = 37,
className,
}: VirtualizedTreeProps<T>) {