From 47f08dba04b7f8fdadf53e6fe4980807841a2ae0 Mon Sep 17 00:00:00 2001 From: wuyang6 Date: Mon, 11 May 2026 20:53:08 +0800 Subject: [PATCH] Fix sidebar session list responsiveness --- frontend/app/app/assistant.tsx | 7 +- .../components/assistant-ui/thread-list.tsx | 273 +++++++++--------- .../assistant-ui/threadlist-sidebar.tsx | 4 +- frontend/app/components/ui/sidebar.tsx | 12 +- frontend/app/hooks/use-mobile.ts | 2 +- 5 files changed, 153 insertions(+), 145 deletions(-) diff --git a/frontend/app/app/assistant.tsx b/frontend/app/app/assistant.tsx index f423acb..a5addcd 100644 --- a/frontend/app/app/assistant.tsx +++ b/frontend/app/app/assistant.tsx @@ -14,7 +14,11 @@ import { } from "@/components/assistant-ui/activity-panel"; import { Thread } from "@/components/assistant-ui/thread"; import { ThreadListSidebar } from "@/components/assistant-ui/threadlist-sidebar"; -import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"; +import { + SidebarInset, + SidebarProvider, + SidebarTrigger, +} from "@/components/ui/sidebar"; import { ClawSessionReplayProvider } from "@/lib/claw-session-replay"; import { ClawAccountGate, useClawAccount } from "./claw-account-gate"; @@ -85,6 +89,7 @@ export const Assistant = () => {
+ setAccount(null)} diff --git a/frontend/app/components/assistant-ui/thread-list.tsx b/frontend/app/components/assistant-ui/thread-list.tsx index ee8a601..9c1aff1 100644 --- a/frontend/app/components/assistant-ui/thread-list.tsx +++ b/frontend/app/components/assistant-ui/thread-list.tsx @@ -95,7 +95,7 @@ type ClawStoredToolCall = { export const ThreadList: FC = () => { return ( - + @@ -146,8 +146,7 @@ const ClawSessionList: FC = () => { fetch("/api/claw/sessions") .then((res) => (res.ok ? res.json() : [])) .then((payload) => { - if (Array.isArray(payload)) - setSessions(dedupeSessions(payload).slice(0, 8)); + if (Array.isArray(payload)) setSessions(dedupeSessions(payload)); }) .catch(() => setSessions([])); }; @@ -204,154 +203,158 @@ const ClawSessionList: FC = () => { }; return ( -
- {sessions.map((session) => { - const active = activeSessionId === session.session_id; - const loading = loadingSessionId === session.session_id; - return ( -
- {renamingSessionId === session.session_id ? ( -
- setDraftTitle(event.target.value)} - onBlur={() => { - saveTitle( - session.session_id, - session.preview || session.session_id, - ); - }} - onKeyDown={(event: KeyboardEvent) => { - if (event.key === "Enter") { - event.preventDefault(); - event.currentTarget.blur(); - } - if (event.key === "Escape") { - event.preventDefault(); - setRenamingSessionId(null); - setDraftTitle(""); - } - }} - /> -
- ) : ( - - )} - - {openMenuSessionId === session.session_id ? ( -
+ {renamingSessionId === session.session_id ? ( +
+ setDraftTitle(event.target.value)} + onBlur={() => { + saveTitle( + session.session_id, + session.preview || session.session_id, + ); + }} + onKeyDown={(event: KeyboardEvent) => { + if (event.key === "Enter") { + event.preventDefault(); + event.currentTarget.blur(); + } + if (event.key === "Escape") { + event.preventDefault(); + setRenamingSessionId(null); + setDraftTitle(""); + } + }} + /> +
+ ) : ( - -
- ) : null} -
- ); - })} + )} + + {openMenuSessionId === session.session_id ? ( +
+ + +
+ ) : null} +
+ ); + })} +
); }; diff --git a/frontend/app/components/assistant-ui/threadlist-sidebar.tsx b/frontend/app/components/assistant-ui/threadlist-sidebar.tsx index df956fa..b0b8277 100644 --- a/frontend/app/components/assistant-ui/threadlist-sidebar.tsx +++ b/frontend/app/components/assistant-ui/threadlist-sidebar.tsx @@ -117,7 +117,7 @@ export function ThreadListSidebar({ - + @@ -341,7 +341,7 @@ function useSidebarSessions(open: boolean) { .then((res) => (res.ok ? res.json() : [])) .then((payload) => { if (cancelled || !Array.isArray(payload)) return; - setSessions(dedupeSidebarSessions(payload).slice(0, 12)); + setSessions(dedupeSidebarSessions(payload)); }) .catch(() => { if (!cancelled) setSessions([]); diff --git a/frontend/app/components/ui/sidebar.tsx b/frontend/app/components/ui/sidebar.tsx index 7067b2e..b2352ca 100644 --- a/frontend/app/components/ui/sidebar.tsx +++ b/frontend/app/components/ui/sidebar.tsx @@ -205,7 +205,7 @@ function Sidebar({ return (