Skip to content

Commit eeebb1c

Browse files
committed
fix(web): remove activity log inner scroll
1 parent 641449d commit eeebb1c

2 files changed

Lines changed: 16 additions & 35 deletions

File tree

apps/web/src/components/ActivityLog.tsx

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { User } from "lucide-react";
2-
import { useEffect, useRef, useState } from "react";
32
import ReactMarkdown from "react-markdown";
43
import rehypeHighlight from "rehype-highlight";
54
import remarkGfm from "remark-gfm";
65

76
import { AgentIdenticon } from "./AgentIdenticon";
87
import { formatRelative } from "./TaskDetailFields";
9-
import { Button } from "./ui/button";
108

119
interface ActivityLogProps {
1210
initialNotes: any[];
@@ -107,10 +105,6 @@ function hasBody(log: any): boolean {
107105
}
108106

109107
export function ActivityLog({ initialNotes, sseNotes, reconnecting }: ActivityLogProps) {
110-
const containerRef = useRef<HTMLDivElement>(null);
111-
const [autoScroll, setAutoScroll] = useState(true);
112-
const [newCount, setNewCount] = useState(0);
113-
114108
const displayed = (() => {
115109
const seen = new Set<string>();
116110
const merged: any[] = [];
@@ -123,28 +117,6 @@ export function ActivityLog({ initialNotes, sseNotes, reconnecting }: ActivityLo
123117
return merged.sort((a, b) => a.created_at.localeCompare(b.created_at));
124118
})();
125119

126-
useEffect(() => {
127-
if (autoScroll && containerRef.current) {
128-
containerRef.current.scrollTop = containerRef.current.scrollHeight;
129-
} else if (!autoScroll && sseNotes.length > 0) {
130-
setNewCount((c) => c + 1);
131-
}
132-
}, [autoScroll, sseNotes.length]);
133-
134-
function handleScroll() {
135-
if (!containerRef.current) return;
136-
const { scrollTop, scrollHeight, clientHeight } = containerRef.current;
137-
const atBottom = scrollHeight - scrollTop - clientHeight < 20;
138-
setAutoScroll(atBottom);
139-
if (atBottom) setNewCount(0);
140-
}
141-
142-
function scrollToLatest() {
143-
containerRef.current?.scrollTo({ top: containerRef.current.scrollHeight, behavior: "smooth" });
144-
setNewCount(0);
145-
setAutoScroll(true);
146-
}
147-
148120
if (displayed.length === 0) {
149121
return <p className="text-sm text-content-tertiary">No activity yet. Assign an agent to see notes.</p>;
150122
}
@@ -153,13 +125,7 @@ export function ActivityLog({ initialNotes, sseNotes, reconnecting }: ActivityLo
153125
<div className="relative">
154126
{reconnecting && <div className="text-[10px] text-warning mb-1">Reconnecting...</div>}
155127

156-
{newCount > 0 && !autoScroll && (
157-
<Button onClick={scrollToLatest} size="xs" className="absolute bottom-2 left-1/2 -translate-x-1/2 z-10 text-[11px] font-mono">
158-
{newCount} new
159-
</Button>
160-
)}
161-
162-
<div ref={containerRef} onScroll={handleScroll} className="mt-2 max-h-96 overflow-y-auto pr-1" aria-live="polite">
128+
<div className="mt-2 pr-1" aria-live="polite">
163129
<div className="relative">
164130
<div className="absolute left-3.5 top-0 bottom-0 w-px bg-border" />
165131

tests/frontend-activity-card.test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ describe("ActivityLog", () => {
7272
expect(text.indexOf("claimed this task")).toBeLessThan(text.indexOf("completed this task"));
7373
});
7474

75+
it("does not create an inner scroll region", () => {
76+
render(
77+
React.createElement(ActivityLog, {
78+
reconnecting: false,
79+
initialNotes: [note({ id: "older", action: "created", created_at: "2026-05-04T10:01:00.000Z" })],
80+
sseNotes: [],
81+
}),
82+
);
83+
84+
const liveRegion = screen.getByText("created this task").closest("[aria-live='polite']");
85+
86+
expect(liveRegion?.className).not.toContain("overflow-y-auto");
87+
expect(liveRegion?.className).not.toContain("max-h-");
88+
});
89+
7590
it("renders comment detail as GitHub-style markdown content", () => {
7691
const markdown = [
7792
"## Review notes",

0 commit comments

Comments
 (0)