mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-19 12:24:46 +08:00
feat: set active tab to activities on research change
This commit is contained in:
@@ -63,6 +63,11 @@ export function ResearchBlock({
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}, [reportId]);
|
}, [reportId]);
|
||||||
|
|
||||||
|
// When the research id changes, set the active tab to activities
|
||||||
|
useEffect(() => {
|
||||||
|
setActiveTab("activities");
|
||||||
|
}, [researchId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn("h-full w-full", className)}>
|
<div className={cn("h-full w-full", className)}>
|
||||||
<Card className={cn("relative h-full w-full pt-4", className)}>
|
<Card className={cn("relative h-full w-full pt-4", className)}>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import { useEffect } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import { useStickToBottom } from "use-stick-to-bottom";
|
import { useStickToBottom } from "use-stick-to-bottom";
|
||||||
|
|
||||||
import { ScrollArea } from "~/components/ui/scroll-area";
|
import { ScrollArea } from "~/components/ui/scroll-area";
|
||||||
@@ -23,11 +23,18 @@ export function ScrollContainer({
|
|||||||
const { scrollRef, contentRef } = useStickToBottom({
|
const { scrollRef, contentRef } = useStickToBottom({
|
||||||
initial: "instant",
|
initial: "instant",
|
||||||
});
|
});
|
||||||
|
const tempScrollRef = useRef<HTMLElement>(null);
|
||||||
|
const tempContentRef = useRef<HTMLElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!autoScrollToBottom) {
|
if (!autoScrollToBottom) {
|
||||||
|
tempScrollRef.current = scrollRef.current;
|
||||||
|
tempContentRef.current = contentRef.current;
|
||||||
scrollRef.current = null;
|
scrollRef.current = null;
|
||||||
contentRef.current = null;
|
contentRef.current = null;
|
||||||
|
} else if (tempScrollRef.current && tempContentRef.current) {
|
||||||
|
scrollRef.current = tempScrollRef.current;
|
||||||
|
contentRef.current = tempContentRef.current;
|
||||||
}
|
}
|
||||||
}, [autoScrollToBottom, contentRef, scrollRef]);
|
}, [autoScrollToBottom, contentRef, scrollRef]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user