From 498eca1e319f1b3552bc0b820e7ac2c78ae30e5e Mon Sep 17 00:00:00 2001 From: scyyw24 Date: Tue, 16 Dec 2025 22:26:55 +0000 Subject: [PATCH] Update Sessions.tsx --- .../pages/home/Tabs/components/Sessions.tsx | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/renderer/src/pages/home/Tabs/components/Sessions.tsx b/src/renderer/src/pages/home/Tabs/components/Sessions.tsx index 7c32b10d4f..5b9f1360c6 100644 --- a/src/renderer/src/pages/home/Tabs/components/Sessions.tsx +++ b/src/renderer/src/pages/home/Tabs/components/Sessions.tsx @@ -1,4 +1,4 @@ -import { DraggableVirtualList, type DraggableVirtualListRef } from '@renderer/components/DraggableList' +import { DynamicVirtualList, type DynamicVirtualListRef } from '@renderer/components/VirtualList' import { useCreateDefaultSession } from '@renderer/hooks/agents/useCreateDefaultSession' import { useSessions } from '@renderer/hooks/agents/useSessions' import { useRuntime } from '@renderer/hooks/useRuntime' @@ -14,6 +14,7 @@ import { Alert, Spin } from 'antd' import { motion } from 'framer-motion' import { memo, useCallback, useEffect, useRef } from 'react' import { useTranslation } from 'react-i18next' +import styled from 'styled-components' import AddButton from './AddButton' import SessionItem from './SessionItem' @@ -24,12 +25,12 @@ interface SessionsProps { const Sessions: React.FC = ({ agentId }) => { const { t } = useTranslation() - const { sessions, isLoading, error, deleteSession, hasMore, loadMore, isLoadingMore, total } = useSessions(agentId) + const { sessions, isLoading, error, deleteSession, hasMore, loadMore, isLoadingMore } = useSessions(agentId) const { chat } = useRuntime() const { activeSessionIdMap } = chat const dispatch = useAppDispatch() const { createDefaultSession, creatingSession } = useCreateDefaultSession(agentId) - const listRef = useRef(null) + const listRef = useRef(null) // Handle scroll to load more useEffect(() => { @@ -113,20 +114,18 @@ const Sessions: React.FC = ({ agentId }) => { } return ( - 9 * 4} + // FIXME: This component only supports CSSProperties + scrollerStyle={{ overflowX: 'hidden' }} + autoHideScrollbar header={ - <> - - {t('agent.session.add.title')} - -
- + + {t('agent.session.add.title')} + }> {(session, index) => ( <> @@ -144,8 +143,15 @@ const Sessions: React.FC = ({ agentId }) => { )} )} -
+ ) } +const StyledVirtualList = styled(DynamicVirtualList)` + display: flex; + flex-direction: column; + padding: 12px 10px; + height: 100%; +` as typeof DynamicVirtualList + export default memo(Sessions)