sidebar: Fix sidebar and archive view content display (#51930)
Danilo Leal
,
Ben Brandt
,
Bennet Bo Fenner
, and
cameron
created
- 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 <benjamin.j.brandt@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: cameron <cameron.studdstreet@gmail.com>
@@ -188,14 +188,6 @@ impl SidebarThreadMetadataStore {
})
}
- pub fn list_sidebar_ids(&self, cx: &App) -> Task<Result<Vec<acp::SessionId>>> {- 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<Result<Vec<ThreadMetadata>>> {
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<Vec<acp::SessionId>> {- self.select::<Arc<str>>(- "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<Vec<ThreadMetadata>> {
self.select::<ThreadMetadata>(
@@ -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<TimeBucket> = 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) {