diff --git a/crates/copilot/src/sign_in.rs b/crates/copilot/src/sign_in.rs index 4f71a34408e23f099d4d3c145d86af24e607e3c3..ed633fe9306abf9b060027e562909edd05dad8fb 100644 --- a/crates/copilot/src/sign_in.rs +++ b/crates/copilot/src/sign_in.rs @@ -89,10 +89,12 @@ fn copilot_toast(message: Option<&'static str>, window: &Window, cx: &mut App) { return; }; - workspace.update(cx, |workspace, cx| match message { - Some(message) => workspace.show_toast(Toast::new(NOTIFICATION_ID, message), cx), - None => workspace.dismiss_toast(&NOTIFICATION_ID, cx), - }); + cx.defer(move |cx| { + workspace.update(cx, |workspace, cx| match message { + Some(message) => workspace.show_toast(Toast::new(NOTIFICATION_ID, message), cx), + None => workspace.dismiss_toast(&NOTIFICATION_ID, cx), + }); + }) } pub fn initiate_sign_in_impl(is_reinstall: bool, window: &mut Window, cx: &mut App) {