diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index 50ededd122..c47614743e 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 e3a7aeefda..23a6a5e168 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);