diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index 50ededd122c137ca599449302513dd26741e41a1..c47614743e2ad47f75add05937845859caf32eeb 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 e3a7aeefda4ab8ab8ea6c583ba59b2549c98a5f6..23a6a5e168fcd3e335bf302c42b31ae278ed6921 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);