mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-30 11:54:03 +00:00
Fix a bug where the draft thread was being spuriously dropped from the sidebar (#52936)
Self-Review Checklist: - [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
This commit is contained in:
parent
94ea487d4c
commit
bbde01ae3b
1 changed files with 13 additions and 7 deletions
|
|
@ -709,19 +709,25 @@ impl Sidebar {
|
|||
// Derive active_entry from the active workspace's agent panel.
|
||||
// Draft is checked first because a conversation can have a session_id
|
||||
// before any messages are sent. However, a thread that's still loading
|
||||
// also appears as a "draft" (no messages yet), so when we already have
|
||||
// an eager Thread write for this workspace we preserve it. A session_id
|
||||
// on a non-draft is a positive Thread signal. The remaining case
|
||||
// (conversation exists, not draft, no session_id) is a genuine
|
||||
// mid-load — keep the previous value.
|
||||
// also appears as a "draft" (no messages yet).
|
||||
if let Some(active_ws) = &active_workspace {
|
||||
if let Some(panel) = active_ws.read(cx).panel::<AgentPanel>(cx) {
|
||||
if panel.read(cx).active_thread_is_draft(cx)
|
||||
|| panel.read(cx).active_conversation_view().is_none()
|
||||
{
|
||||
let conversation_parent_id = panel
|
||||
.read(cx)
|
||||
.active_conversation_view()
|
||||
.and_then(|cv| cv.read(cx).parent_id(cx));
|
||||
let preserving_thread =
|
||||
matches!(&self.active_entry, Some(ActiveEntry::Thread { .. }))
|
||||
&& self.active_entry_workspace() == Some(active_ws);
|
||||
if let Some(ActiveEntry::Thread { session_id, .. }) = &self.active_entry {
|
||||
self.active_entry_workspace() == Some(active_ws)
|
||||
&& conversation_parent_id
|
||||
.as_ref()
|
||||
.is_some_and(|id| id == session_id)
|
||||
} else {
|
||||
false
|
||||
};
|
||||
if !preserving_thread {
|
||||
self.active_entry = Some(ActiveEntry::Draft(active_ws.clone()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue