From d8fd1f5a49475e00fade03ed9246e11aa4f178fe Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:20:50 -0600 Subject: [PATCH] Defer first update active buffer for conversation (cherry-pick #10564) (#10567) Cherry-picked Defer first update active buffer for conversation (#10564) This fixes when the workspace is not actually available for a `.read(cx)`. Release Notes: - Fix a panic when quoting a selection before the assistant panel has been started Co-authored-by: Conrad Irwin Co-authored-by: Kyle Kelley Co-authored-by: Conrad Irwin --- crates/assistant/src/assistant_panel.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs index 041bd2f62dcf186e876e789daa51dcf7288d70e6..9b9861236a05202a5bc1b7ef126d84cfb70a53f9 100644 --- a/crates/assistant/src/assistant_panel.rs +++ b/crates/assistant/src/assistant_panel.rs @@ -2060,7 +2060,7 @@ impl ConversationEditor { workspace: workspace.downgrade(), _subscriptions, }; - this.update_active_buffer(workspace, cx); + cx.defer(|this, cx| this.update_active_buffer(workspace, cx)); this.update_message_headers(cx); this }