Fail better when workspace restoration all fails (#50330)
Release Notes: - Fixed a bug that caused Zed to appear not to open if your workspaces failed to restore
This commit is contained in:
1 parent
3dc87b763a
commit
b7e2dd9c30
1 file changed
+17
-5
+17
-5
@@ -1398,7 +1398,7 @@ pub(crate) async fn restore_or_create_workspace(
|
||||
.update(cx, |multi_workspace, _, cx| {
|
||||
multi_workspace.workspace().update(cx, |workspace, cx| {
|
||||
workspace.show_toast(
|
||||
Toast::new(NotificationId::unique::<()>(), message),
|
||||
Toast::new(NotificationId::unique::<()>(), message.clone()),
|
||||
cx,
|
||||
)
|
||||
});
|
||||
@@ -1410,11 +1410,23 @@ pub(crate) async fn restore_or_create_workspace(
|
||||
});
|
||||
|
||||
// If we couldn't show a toast (no windows opened successfully),
|
||||
// we've already logged the errors above, so the user can check logs
|
||||
// open a fallback empty workspace and show the error there
|
||||
if !toast_shown {
|
||||
log::error!(
|
||||
"Failed to show notification for window restoration errors, because no workspace windows were available."
|
||||
);
|
||||
log::error!("All workspace restorations failed. Opening fallback empty workspace.");
|
||||
cx.update(|cx| {
|
||||
workspace::open_new(
|
||||
Default::default(),
|
||||
app_state.clone(),
|
||||
cx,
|
||||
|workspace, _window, cx| {
|
||||
workspace.show_toast(
|
||||
Toast::new(NotificationId::unique::<()>(), message),
|
||||
cx,
|
||||
);
|
||||
},
|
||||
)
|
||||
})
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
} else if matches!(KEY_VALUE_STORE.read_kvp(FIRST_OPEN), Ok(None)) {
|
||||
|
||||
Reference in new issue
Block a user