Update components.rs

This commit is contained in:
Mikayla Maki 2023-08-19 04:30:49 -07:00 committed by GitHub
parent 29c339e3b4
commit b7e03507c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -175,8 +175,13 @@ pub mod action_button {
.on_click(MouseButton::Left, { .on_click(MouseButton::Left, {
let action = self.action.boxed_clone(); let action = self.action.boxed_clone();
move |_, _, cx| { move |_, _, cx| {
cx.window() let window = cx.window();
.dispatch_action(cx.view_id(), action.as_ref(), cx); 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) .with_cursor_style(CursorStyle::PointingHand)