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(