diff --git a/crates/workspace/src/persistence/model.rs b/crates/workspace/src/persistence/model.rs index c75ea2f52f..73ae0f9b7e 100644 --- a/crates/workspace/src/persistence/model.rs +++ b/crates/workspace/src/persistence/model.rs @@ -233,24 +233,28 @@ impl SerializedPane { workspace: WeakView, cx: &mut AsyncWindowContext, ) -> Result>>> { - let mut items = Vec::new(); + let mut item_tasks = Vec::new(); let mut active_item_index = None; for (index, item) in self.children.iter().enumerate() { let project = project.clone(); - let item_handle = pane - .update(cx, |_, cx| { - if let Some(deserializer) = cx.global::().get(&item.kind) { - deserializer(project, workspace.clone(), workspace_id, item.item_id, cx) - } else { - Task::ready(Err(anyhow::anyhow!( - "Deserializer does not exist for item kind: {}", - item.kind - ))) - } - })? - .await - .log_err(); + item_tasks.push(pane.update(cx, |_, cx| { + if let Some(deserializer) = cx.global::().get(&item.kind) { + deserializer(project, workspace.clone(), workspace_id, item.item_id, cx) + } else { + Task::ready(Err(anyhow::anyhow!( + "Deserializer does not exist for item kind: {}", + item.kind + ))) + } + })?); + if item.active { + active_item_index = Some(index); + } + } + let mut items = Vec::new(); + for item_handle in futures::future::join_all(item_tasks).await { + let item_handle = item_handle.log_err(); items.push(item_handle.clone()); if let Some(item_handle) = item_handle { @@ -258,10 +262,6 @@ impl SerializedPane { pane.add_item(item_handle.clone(), true, true, None, cx); })?; } - - if item.active { - active_item_index = Some(index); - } } if let Some(active_item_index) = active_item_index {