Skip to content

Commit 32e3162

Browse files
committed
fix: render full thread history
1 parent e1172c8 commit 32e3162

1 file changed

Lines changed: 1 addition & 29 deletions

File tree

src/components/Messages.tsx

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,8 @@ function toolStatusTone(
176176
}
177177

178178
export function Messages({ items, isThinking }: MessagesProps) {
179-
const listRef = useRef<HTMLDivElement | null>(null);
180179
const bottomRef = useRef<HTMLDivElement | null>(null);
181-
const seenItems = useRef(new Set<string>());
182180
const [expandedItems, setExpandedItems] = useState<Set<string>>(new Set());
183-
const [showAll, setShowAll] = useState(false);
184-
const maxVisibleItems = 30;
185181
const toggleExpanded = (id: string) => {
186182
setExpandedItems((prev) => {
187183
const next = new Set(prev);
@@ -194,18 +190,7 @@ export function Messages({ items, isThinking }: MessagesProps) {
194190
});
195191
};
196192

197-
const visibleItems =
198-
!showAll && items.length > maxVisibleItems
199-
? items.slice(-maxVisibleItems)
200-
: items;
201-
202-
useEffect(() => {
203-
items.forEach((item) => {
204-
if (!seenItems.current.has(item.id)) {
205-
seenItems.current.add(item.id);
206-
}
207-
});
208-
}, [items]);
193+
const visibleItems = items;
209194

210195
useEffect(() => {
211196
if (!bottomRef.current) {
@@ -231,20 +216,7 @@ export function Messages({ items, isThinking }: MessagesProps) {
231216

232217
return (
233218
<div
234-
ref={listRef}
235219
className="messages messages-full"
236-
onScroll={() => {
237-
const node = listRef.current;
238-
if (!node) {
239-
return;
240-
}
241-
const distanceFromBottom = node.scrollHeight - node.scrollTop - node.clientHeight;
242-
if (!showAll && node.scrollTop <= 80) {
243-
setShowAll(true);
244-
} else if (showAll && distanceFromBottom <= 80) {
245-
setShowAll(false);
246-
}
247-
}}
248220
>
249221
{visibleItems.map((item) => {
250222
if (item.kind === "message") {

0 commit comments

Comments
 (0)