diff --git a/web/src/app/_components/research-block.tsx b/web/src/app/_components/research-block.tsx
index fb3507c..1f55536 100644
--- a/web/src/app/_components/research-block.tsx
+++ b/web/src/app/_components/research-block.tsx
@@ -63,6 +63,11 @@ export function ResearchBlock({
}, 1000);
}, [reportId]);
+ // When the research id changes, set the active tab to activities
+ useEffect(() => {
+ setActiveTab("activities");
+ }, [researchId]);
+
return (
diff --git a/web/src/app/_components/scroll-container.tsx b/web/src/app/_components/scroll-container.tsx
index a3a546e..ecc7d01 100644
--- a/web/src/app/_components/scroll-container.tsx
+++ b/web/src/app/_components/scroll-container.tsx
@@ -1,7 +1,7 @@
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
// SPDX-License-Identifier: MIT
-import { useEffect } from "react";
+import { useEffect, useRef } from "react";
import { useStickToBottom } from "use-stick-to-bottom";
import { ScrollArea } from "~/components/ui/scroll-area";
@@ -23,11 +23,18 @@ export function ScrollContainer({
const { scrollRef, contentRef } = useStickToBottom({
initial: "instant",
});
+ const tempScrollRef = useRef(null);
+ const tempContentRef = useRef(null);
useEffect(() => {
if (!autoScrollToBottom) {
+ tempScrollRef.current = scrollRef.current;
+ tempContentRef.current = contentRef.current;
scrollRef.current = null;
contentRef.current = null;
+ } else if (tempScrollRef.current && tempContentRef.current) {
+ scrollRef.current = tempScrollRef.current;
+ contentRef.current = tempContentRef.current;
}
}, [autoScrollToBottom, contentRef, scrollRef]);