diff --git a/crates/sidebar/src/sidebar.rs b/crates/sidebar/src/sidebar.rs index 7bb4a528377203e7527a0c412967b4561c70f15c..f2fc4f6585a27b6eba33fef2c99ee8c897773753 100644 --- a/crates/sidebar/src/sidebar.rs +++ b/crates/sidebar/src/sidebar.rs @@ -654,12 +654,9 @@ impl Sidebar { let query = self.filter_editor.read(cx).text(cx); - // Derive active_entry from the active workspace's agent panel. - // Thread when the panel has a non-draft thread, Draft when the - // workspace has no active thread (or no panel at all). - // Only overwrite with Thread on a positive signal — if the panel - // transiently returns None while loading, keep the previous value - // so eager writes from user actions survive. + // Update active_entry to reflect the focused thread in the + // agent panel. If the panel has no focused thread, leave + // active_entry alone to preserve optimistic UI set by user actions. let panel_focused = active_workspace .as_ref() .and_then(|ws| ws.read(cx).panel::(cx)) @@ -2443,7 +2440,7 @@ impl Sidebar { // Delete from the store and clean up empty worktree workspaces. let delete_task = SidebarThreadMetadataStore::global(cx) - .update(cx, |store, cx| store.delete(session_id, cx)); + .update(cx, |store, cx| store.delete(session_id.clone(), cx)); cx.spawn_in(window, async move |this, cx| { delete_task.await?;