Fix update status logic to preserve previous status (#31202)

Release Notes:

- N/A
This commit is contained in:
Joseph T. Lyons 2025-05-22 13:34:14 -04:00 committed by GitHub
parent e3d3daec92
commit b188e5d3aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -492,10 +492,8 @@ impl AutoUpdater {
}
async fn update(this: Entity<Self>, mut cx: AsyncApp) -> Result<()> {
let (client, installed_version, status, release_channel) =
let (client, installed_version, previous_status, release_channel) =
this.update(&mut cx, |this, cx| {
this.status = AutoUpdateStatus::Checking;
cx.notify();
(
this.http_client.clone(),
this.current_version,
@ -504,6 +502,11 @@ impl AutoUpdater {
)
})?;
this.update(&mut cx, |this, cx| {
this.status = AutoUpdateStatus::Checking;
cx.notify();
})?;
let fetched_release_data =
Self::get_latest_release(&this, "zed", OS, ARCH, release_channel, &mut cx).await?;
let fetched_version = fetched_release_data.clone().version;
@ -512,16 +515,18 @@ impl AutoUpdater {
*RELEASE_CHANNEL,
app_commit_sha,
installed_version,
status,
previous_status.clone(),
fetched_version,
)?;
let Some(newer_version) = newer_version else {
return this.update(&mut cx, |this, cx| {
if !matches!(this.status, AutoUpdateStatus::Updated { .. }) {
this.status = AutoUpdateStatus::Idle;
cx.notify();
}
let status = match previous_status {
AutoUpdateStatus::Updated { .. } => previous_status,
_ => AutoUpdateStatus::Idle,
};
this.status = status;
cx.notify();
});
};