From bd3cccea1549dc3b3c5b8b77c812b562f942dc04 Mon Sep 17 00:00:00 2001 From: Xiaobo Liu Date: Sat, 27 Sep 2025 02:42:06 +0800 Subject: [PATCH] edit_prediction_button: Fix Copilot menu not updating after sign out (#38854) The edit prediction button menu was displaying stale authentication status due to capturing the Copilot status in a closure. After signing out, the menu would still show "Sign Out" instead of "Sign In to Copilot". This change fixes the issue by reading the current Copilot status each time the menu is displayed, ensuring the menu options are always accurate. Release Notes: - Fixed Copilot AI menu not updating after sign out Signed-off-by: Xiaobo Liu --- crates/edit_prediction_button/src/edit_prediction_button.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/edit_prediction_button/src/edit_prediction_button.rs b/crates/edit_prediction_button/src/edit_prediction_button.rs index 8822c05f6c4d1842fd74d45d876f64736eb62fbc..b2186c6aae592b5a4f73f1caaeb9e6c267d82afc 100644 --- a/crates/edit_prediction_button/src/edit_prediction_button.rs +++ b/crates/edit_prediction_button/src/edit_prediction_button.rs @@ -132,7 +132,8 @@ impl Render for EditPredictionButton { div().child( PopoverMenu::new("copilot") .menu(move |window, cx| { - Some(match status { + let current_status = Copilot::global(cx)?.read(cx).status(); + Some(match current_status { Status::Authorized => this.update(cx, |this, cx| { this.build_copilot_context_menu(window, cx) }),