From 9ed00940452949f41928b3d7115d893992e49ec7 Mon Sep 17 00:00:00 2001 From: anti Date: Thu, 30 Apr 2026 00:30:46 -0400 Subject: [PATCH] fix(ui): reset live feed scroll to top on log update Sticky thead was floating mid-content when the container auto-scrolled as new log entries arrived. Pinning scrollTop to 0 on each logs update keeps the thead at position 0 where it belongs. --- decnet_web/src/components/Dashboard.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/decnet_web/src/components/Dashboard.tsx b/decnet_web/src/components/Dashboard.tsx index 7aabcb90..4dc2d023 100644 --- a/decnet_web/src/components/Dashboard.tsx +++ b/decnet_web/src/components/Dashboard.tsx @@ -89,6 +89,7 @@ const Dashboard: React.FC = ({ searchQuery }) => { const lastStatsRef = useRef<{ total: number; uniq: number; bounties: number } | null>(null); const eventSourceRef = useRef(null); const reconnectTimerRef = useRef | null>(null); + const logsContainerRef = useRef(null); useEffect(() => { const connect = () => { @@ -135,6 +136,11 @@ const Dashboard: React.FC = ({ searchQuery }) => { }; }, [searchQuery]); + // Keep the live feed scrolled to the top so the sticky thead never floats. + useEffect(() => { + if (logsContainerRef.current) logsContainerRef.current.scrollTop = 0; + }, [logs]); + // Tick once a second so the 5-min rolling window stays accurate even // when logs haven't arrived. const [nowTick, setNowTick] = useState(() => Date.now()); @@ -312,7 +318,7 @@ const Dashboard: React.FC = ({ searchQuery }) => { {logs.length} RECENT -
+