From 722b3c4c850c4446f3fb9979956bdb82c0355c28 Mon Sep 17 00:00:00 2001 From: nuthalapativarun Date: Tue, 16 Jun 2026 11:34:15 -0700 Subject: [PATCH] fix: refresh session name in sidebar after rename (#9543) Signed-off-by: Varun Nuthalapati Co-authored-by: Claude Sonnet 4.6 --- ui/desktop/src/components/Layout/NavigationPanel.tsx | 5 +++++ .../src/components/sessions/SessionListView.tsx | 6 ++++-- ui/desktop/src/hooks/useNavigationSessions.ts | 11 ++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ui/desktop/src/components/Layout/NavigationPanel.tsx b/ui/desktop/src/components/Layout/NavigationPanel.tsx index b2cc8d13b..f9140eca3 100644 --- a/ui/desktop/src/components/Layout/NavigationPanel.tsx +++ b/ui/desktop/src/components/Layout/NavigationPanel.tsx @@ -106,6 +106,11 @@ const SessionRow: React.FC = ({ session, active, status, onClic path: { session_id: session.id }, body: { name: newName }, }); + window.dispatchEvent( + new CustomEvent(AppEvents.SESSION_RENAMED, { + detail: { sessionId: session.id, newName, userInitiated: true }, + }) + ); onRenamed(); }} placeholder={intl.formatMessage(i18n.untitledSession)} diff --git a/ui/desktop/src/components/sessions/SessionListView.tsx b/ui/desktop/src/components/sessions/SessionListView.tsx index 2f40af838..c3156de9c 100644 --- a/ui/desktop/src/components/sessions/SessionListView.tsx +++ b/ui/desktop/src/components/sessions/SessionListView.tsx @@ -458,11 +458,13 @@ const SessionListView: React.FC = React.memo( const handleModalSave = useCallback(async (sessionId: string, newDescription: string) => { // Update state immediately for optimistic UI setSessions((prevSessions) => - prevSessions.map((s) => (s.id === sessionId ? { ...s, name: newDescription } : s)) + prevSessions.map((s) => + s.id === sessionId ? { ...s, name: newDescription, user_set_name: true } : s + ) ); window.dispatchEvent( new CustomEvent(AppEvents.SESSION_RENAMED, { - detail: { sessionId, newName: newDescription }, + detail: { sessionId, newName: newDescription, userInitiated: true }, }) ); }, []); diff --git a/ui/desktop/src/hooks/useNavigationSessions.ts b/ui/desktop/src/hooks/useNavigationSessions.ts index 23441d16d..511339a8d 100644 --- a/ui/desktop/src/hooks/useNavigationSessions.ts +++ b/ui/desktop/src/hooks/useNavigationSessions.ts @@ -146,11 +146,16 @@ export function useNavigationSessions() { }; const handleSessionRenamed = (event: Event) => { - const { sessionId, newName } = (event as CustomEvent<{ sessionId: string; newName: string }>) - .detail; + const { sessionId, newName, userInitiated } = ( + event as CustomEvent<{ sessionId: string; newName: string; userInitiated?: boolean }> + ).detail; setRecentSessions((prev) => - prev.map((session) => (session.id === sessionId ? { ...session, name: newName } : session)) + prev.map((session) => + session.id === sessionId + ? { ...session, name: newName, ...(userInitiated && { user_set_name: true }) } + : session + ) ); };