fix: match log/timeline height, DESC sort with scroll-to-top
Give logCard the same max-height and flex layout as timelineCard so both columns are equal height. Revert .toReversed() so events stay in DESC order (newest at top). Override EventFeed's auto-scroll-to- bottom with a requestAnimationFrame that resets scrollTop to 0 after mount, keeping newest entries visible at the top of both panels. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState, useMemo } from 'react';
|
||||
import { useState, useMemo, useRef, useEffect } from 'react';
|
||||
import { useParams, Link } from 'react-router';
|
||||
import {
|
||||
StatCard, StatusDot, Badge, MonoText, ProgressBar,
|
||||
@@ -224,6 +224,18 @@ export default function AgentHealth() {
|
||||
const { appId } = useParams();
|
||||
const { data: agents } = useAgents(undefined, appId);
|
||||
const { data: events } = useAgentEvents(appId);
|
||||
const timelineRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// Override EventFeed's auto-scroll-to-bottom so newest (DESC) events stay visible at top
|
||||
useEffect(() => {
|
||||
const el = timelineRef.current;
|
||||
if (!el) return;
|
||||
const timer = requestAnimationFrame(() => {
|
||||
const list = el.querySelector('[aria-label="Event feed"]') as HTMLElement | null;
|
||||
if (list) list.scrollTop = 0;
|
||||
});
|
||||
return () => cancelAnimationFrame(timer);
|
||||
}, [events]);
|
||||
|
||||
const [selectedInstance, setSelectedInstance] = useState<AgentInstance | null>(null);
|
||||
const [panelOpen, setPanelOpen] = useState(false);
|
||||
@@ -256,7 +268,7 @@ export default function AgentHealth() {
|
||||
: ('running' as const),
|
||||
message: `${e.agentId}: ${e.eventType}${e.detail ? ' \u2014 ' + e.detail : ''}`,
|
||||
timestamp: new Date(e.timestamp),
|
||||
})).toReversed(),
|
||||
})),
|
||||
[events],
|
||||
);
|
||||
|
||||
@@ -500,7 +512,7 @@ export default function AgentHealth() {
|
||||
|
||||
{/* EventFeed */}
|
||||
{feedEvents.length > 0 && (
|
||||
<div className={styles.eventCard}>
|
||||
<div className={styles.eventCard} ref={timelineRef}>
|
||||
<div className={styles.eventCardHeader}>
|
||||
<span className={styles.sectionTitle}>Timeline</span>
|
||||
<span className={styles.sectionMeta}>{feedEvents.length} events</span>
|
||||
|
||||
Reference in New Issue
Block a user