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.

Close modals and menus before dispathing actions (#7830)

Kirill Bulatov7c6b34cb73df
diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs
index 50ededd122c..c47614743e2 100644
--- a/crates/command_palette/src/command_palette.rs
+++ b/crates/command_palette/src/command_palette.rs
@@ -317,8 +317,8 @@ impl PickerDelegate for CommandPaletteDelegate {
});
let action = command.action;
cx.focus(&self.previous_focus_handle);
- cx.dispatch_action(action);
self.dismissed(cx);
+ cx.dispatch_action(action);
}
fn render_match(
diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rs
index e3a7aeefda4..23a6a5e168f 100644
--- a/crates/ui/src/components/context_menu.rs
+++ b/crates/ui/src/components/context_menu.rs
@@ -224,8 +224,8 @@ impl ContextMenu {
.timer(Duration::from_millis(50))
.await;
this.update(&mut cx, |this, cx| {
+ this.cancel(&menu::Cancel, cx);
cx.dispatch_action(action);
- this.cancel(&menu::Cancel, cx)
})
})
.detach_and_log_err(cx);