From d09b335492c4bd09f149f18e3442c7f53f7da57f Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Thu, 19 Mar 2026 09:27:06 -0300 Subject: [PATCH] sidebar: Fix sidebar and archive view content display (#51930) - Don't filter out what we show in the archive view; unconditionally display archived threads for all sessions - Ensure we refresh sidebar content on startup --- - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A --------- Co-authored-by: Ben Brandt Co-authored-by: Bennet Bo Fenner Co-authored-by: cameron --- crates/agent_ui/src/thread_metadata_store.rs | 18 ------------------ crates/agent_ui/src/threads_archive_view.rs | 12 +----------- crates/sidebar/src/sidebar.rs | 6 ++++-- 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/crates/agent_ui/src/thread_metadata_store.rs b/crates/agent_ui/src/thread_metadata_store.rs index fdc466d9bfc6130f21e6fe040db654d06fae11f9..7b20ac268271bae977ccae57b84c4401d3c5fc94 100644 --- a/crates/agent_ui/src/thread_metadata_store.rs +++ b/crates/agent_ui/src/thread_metadata_store.rs @@ -188,14 +188,6 @@ impl SidebarThreadMetadataStore { }) } - pub fn list_sidebar_ids(&self, cx: &App) -> Task>> { - let db = self.db.clone(); - cx.background_spawn(async move { - let s = db.list_sidebar_ids()?; - Ok(s) - }) - } - pub fn list(&self, cx: &App) -> Task>> { let db = self.db.clone(); cx.background_spawn(async move { @@ -323,16 +315,6 @@ impl ThreadMetadataDb { .map(|ids| ids.into_iter().map(|id| acp::SessionId::new(id)).collect()) } - /// List session IDs of threads that belong to a real project workspace - /// (i.e. have non-empty folder_paths). These are the threads shown in - /// the sidebar, as opposed to threads created in empty workspaces. - pub fn list_sidebar_ids(&self) -> anyhow::Result> { - self.select::>( - "SELECT session_id FROM sidebar_threads WHERE folder_paths IS NOT NULL AND folder_paths != ''", - )?() - .map(|ids| ids.into_iter().map(|id| acp::SessionId::new(id)).collect()) - } - /// List all sidebar thread metadata, ordered by updated_at descending. pub fn list(&self) -> anyhow::Result> { self.select::( diff --git a/crates/agent_ui/src/threads_archive_view.rs b/crates/agent_ui/src/threads_archive_view.rs index 06085bfc4dfaef9d19e5ead4b5754716d4bb6024..a7faaeca90623edc76a036ca947d2362b0020a33 100644 --- a/crates/agent_ui/src/threads_archive_view.rs +++ b/crates/agent_ui/src/threads_archive_view.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use crate::{ Agent, RemoveSelectedThread, agent_connection_store::AgentConnectionStore, - thread_history::ThreadHistory, thread_metadata_store::SidebarThreadMetadataStore, + thread_history::ThreadHistory, }; use acp_thread::AgentSessionInfo; use agent::ThreadStore; @@ -244,21 +244,11 @@ impl ThreadsArchiveView { let today = Local::now().naive_local().date(); self._update_items_task.take(); - let unarchived_ids_task = SidebarThreadMetadataStore::global(cx) - .read(cx) - .list_sidebar_ids(cx); self._update_items_task = Some(cx.spawn(async move |this, cx| { - let unarchived_session_ids = unarchived_ids_task.await.unwrap_or_default(); - let mut items = Vec::with_capacity(sessions.len() + 5); let mut current_bucket: Option = None; for session in sessions { - // Skip sessions that are shown in the sidebar - if unarchived_session_ids.contains(&session.session_id) { - continue; - } - let highlight_positions = if !query.is_empty() { let title = session.title.as_ref().map(|t| t.as_ref()).unwrap_or(""); match fuzzy_match_positions(&query, title) { diff --git a/crates/sidebar/src/sidebar.rs b/crates/sidebar/src/sidebar.rs index c628ea3288513132c4ecc49dc2dc8c9e75e05ef1..7236e1e5e85f8c1a78638d27975e9dae69b0e31d 100644 --- a/crates/sidebar/src/sidebar.rs +++ b/crates/sidebar/src/sidebar.rs @@ -321,7 +321,7 @@ impl Sidebar { this.update_entries(cx); }); - Self { + let mut this = Self { _list_threads_task: None, multi_workspace: multi_workspace.downgrade(), width: DEFAULT_WIDTH, @@ -340,7 +340,9 @@ impl Sidebar { recent_projects_popover_handle: PopoverMenuHandle::default(), _subscriptions: Vec::new(), _draft_observation: None, - } + }; + this.list_threads(cx); + this } fn subscribe_to_workspace(