From b7e03507c293c49c79a91c5ff78a061cc2408c6d Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Sat, 19 Aug 2023 04:30:49 -0700 Subject: [PATCH] Update components.rs --- crates/theme/src/components.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/theme/src/components.rs b/crates/theme/src/components.rs index fce7ad825cc2ede0a8501dba5ac4fe7ff520bc08..8a0d8527a4d9384c822c6ba0b1b51e52221a588b 100644 --- a/crates/theme/src/components.rs +++ b/crates/theme/src/components.rs @@ -175,8 +175,13 @@ pub mod action_button { .on_click(MouseButton::Left, { let action = self.action.boxed_clone(); move |_, _, cx| { - cx.window() - .dispatch_action(cx.view_id(), action.as_ref(), cx); + let window = cx.window(); + let view = cx.view_id(); + let action = action.boxed_clone(); + cx.spawn(|_, mut cx| async move { + window.dispatch_action(view, action.as_ref(), &mut cx) + }) + .detach(); } }) .with_cursor_style(CursorStyle::PointingHand)