From f6f49ccca53474edbd230a6ab567dd601ea53eda Mon Sep 17 00:00:00 2001 From: chengyongru <61816729+chengyongru@users.noreply.github.com> Date: Wed, 18 Nov 2026 17:46:55 +0800 Subject: [PATCH] fix(webui): scroll search and archive with sidebar topics (#6706) --- webui/src/components/ChatList.tsx | 8 +++- webui/src/components/Sidebar.tsx | 59 ++++++++++++++--------------- webui/src/tests/app-layout.test.tsx | 6 ++- 3 files changed, 40 insertions(+), 33 deletions(-) diff --git a/webui/src/components/ChatList.tsx b/webui/src/components/ChatList.tsx index 3ea4cb1e3..2e975fbd3 100644 --- a/webui/src/components/ChatList.tsx +++ b/webui/src/components/ChatList.tsx @@ -224,6 +224,7 @@ function isWorkbenchTabSurface(target: EventTarget | null): boolean { } interface ChatListProps { + listHeader?: ReactNode; sessions: ChatSummary[]; temporarySessions?: ChatSummary[]; activeKey: string | null; @@ -269,6 +270,7 @@ interface ChatListProps { } export const ChatList = memo(function ChatList({ + listHeader, sessions, temporarySessions = [], activeKey, @@ -313,6 +315,7 @@ export const ChatList = memo(function ChatList({ const [visibleLimit, setVisibleLimit] = useState(INITIAL_VISIBLE_SESSIONS); const scrollViewportRef = useRef(null); const selectionBarRef = useRef(null); + const hasListHeader = Boolean(listHeader); useLayoutEffect(() => { const viewport = scrollViewportRef.current; if (!viewport) return; @@ -332,14 +335,14 @@ export const ChatList = memo(function ChatList({ viewport.addEventListener("scroll", onScroll, { passive: true }); const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(updateEdges); observer?.observe(viewport); - if (viewport.firstElementChild) observer?.observe(viewport.firstElementChild); + for (const child of viewport.children) observer?.observe(child); return () => { viewport.removeEventListener("scroll", onScroll); clearTimeout(idleTimer); delete viewport.dataset.scrolling; observer?.disconnect(); }; - }, [loading, sessions.length, temporarySessions.length]); + }, [hasListHeader, loading, sessions.length, temporarySessions.length]); const layoutRowRefs = useRef(new Map()); const pendingLayoutRectsRef = useRef | null>(null); const layoutAnimationsRef = useRef(new Map()); @@ -709,6 +712,7 @@ export const ChatList = memo(function ChatList({ && selectedArchiveKeys.every((key) => archivedPanes.has(key) || archived.has(key)); return (
+ {listHeader} } - /> - ); - + const sessionActions = useMemo(() => ( +
+ } + /> + {archivedCount ? ( + } + /> + ) : null} +
+ ), [actionInset, apple, archivedCount, collapsed, desktopDock, onOpenSearch, onToggleArchived, showArchived, t]); return (