Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

agent_ui: Switch to All filter when last archived thread is removed (#54763)

XiaoYan Li03064b953fef
diff --git a/crates/agent_ui/src/threads_archive_view.rs b/crates/agent_ui/src/threads_archive_view.rs
index e6e9ca4f5f5..892c6b0c0e4 100644
--- a/crates/agent_ui/src/threads_archive_view.rs
+++ b/crates/agent_ui/src/threads_archive_view.rs
@@ -261,9 +261,19 @@ impl ThreadsArchiveView {
}
fn update_items(&mut self, cx: &mut Context<Self>) {
+ let store = ThreadMetadataStore::global(cx).read(cx);
+
+ // If we're filtering to archived threads but none remain (e.g. the
+ // user just deleted the last one), fall back to showing all threads
+ // so they aren't stranded with an empty list and a disabled toggle.
+ if self.thread_filter == ThreadFilter::ArchivedOnly
+ && store.archived_entries().next().is_none()
+ {
+ self.thread_filter = ThreadFilter::All;
+ }
+
let thread_filter = self.thread_filter;
- let sessions = ThreadMetadataStore::global(cx)
- .read(cx)
+ let sessions = store
.entries()
.filter(|t| match thread_filter {
ThreadFilter::All => true,