From 6bdbab2fafb2698febac66d73b4fceafcaefc18e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 17 Oct 2022 10:05:38 +0200 Subject: [PATCH] Notify `ActivityIndicator` when `AutoUpdater` changes This fixes a bug that caused the status bar to not update when the auto-update system changed its status. --- crates/activity_indicator/src/activity_indicator.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/activity_indicator/src/activity_indicator.rs b/crates/activity_indicator/src/activity_indicator.rs index 596e9ba995..cc788c1e48 100644 --- a/crates/activity_indicator/src/activity_indicator.rs +++ b/crates/activity_indicator/src/activity_indicator.rs @@ -46,6 +46,7 @@ impl ActivityIndicator { cx: &mut ViewContext, ) -> ViewHandle { let project = workspace.project().clone(); + let auto_updater = AutoUpdater::get(cx); let this = cx.add_view(|cx: &mut ViewContext| { let mut status_events = languages.language_server_binary_statuses(); cx.spawn_weak(|this, mut cx| async move { @@ -66,11 +67,14 @@ impl ActivityIndicator { }) .detach(); cx.observe(&project, |_, _, cx| cx.notify()).detach(); + if let Some(auto_updater) = auto_updater.as_ref() { + cx.observe(auto_updater, |_, _, cx| cx.notify()).detach(); + } Self { statuses: Default::default(), project: project.clone(), - auto_updater: AutoUpdater::get(cx), + auto_updater, } }); cx.subscribe(&this, move |workspace, _, event, cx| match event {