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.

Fix panic when opening the same context twice (#14004)

Antonio Scandurrace7074c8831b
diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs
index 5ba8447087a..36899fb6fdc 100644
--- a/crates/assistant/src/assistant_panel.rs
+++ b/crates/assistant/src/assistant_panel.rs
@@ -616,8 +616,9 @@ impl AssistantPanel {
.filter(|editor| editor.read(cx).context.read(cx).path.as_ref() == Some(&path))
});
if let Some(existing_context) = existing_context {
- self.show_context(existing_context, cx);
- return Task::ready(Ok(()));
+ return cx.spawn(|this, mut cx| async move {
+ this.update(&mut cx, |this, cx| this.show_context(existing_context, cx))
+ });
}
let saved_context = self.context_store.read(cx).load(path.clone(), cx);