Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Defer sidebar sync (#53925)

Mikayla Makie8c6f29f444e
diff --git a/crates/workspace/src/multi_workspace.rs b/crates/workspace/src/multi_workspace.rs
index 719b613c69f..67e6e71ffd9 100644
--- a/crates/workspace/src/multi_workspace.rs
+++ b/crates/workspace/src/multi_workspace.rs
@@ -726,11 +726,20 @@ impl MultiWorkspace {
cx: &mut Context<Self>,
) {
Self::subscribe_to_workspace(workspace, window, cx);
- self.sync_sidebar_to_workspace(workspace, cx);
let weak_self = cx.weak_entity();
workspace.update(cx, |workspace, cx| {
workspace.set_multi_workspace(weak_self, cx);
});
+
+ let entity = cx.entity();
+ cx.defer({
+ let workspace = workspace.clone();
+ move |cx| {
+ entity.update(cx, |this, cx| {
+ this.sync_sidebar_to_workspace(&workspace, cx);
+ })
+ }
+ });
}
pub fn project_group_key_for_workspace(