diff --git a/xilem/src/view/message_handler.rs b/xilem/src/view/message_handler.rs index 7299421e6..3e50af3f8 100644 --- a/xilem/src/view/message_handler.rs +++ b/xilem/src/view/message_handler.rs @@ -26,7 +26,7 @@ pub fn message_handler( handle_event: H, ) -> MessageHandler where - F: Fn(&mut State, MessageProxy) + 'static, + F: Fn(&mut State, MessageProxy) -> Action + 'static, H: Fn(&mut State, M) -> Action + 'static, M: Message + 'static, { @@ -48,7 +48,7 @@ pub struct MessageHandler { impl View for MessageHandler where - F: Fn(&mut State, MessageProxy) + 'static, + F: Fn(&mut State, MessageProxy) -> Action + 'static, H: Fn(&mut State, M) -> Action + 'static, M: Message + 'static, { @@ -95,11 +95,12 @@ where ); if message.deref().as_any().is::() { let proxy = MessageProxy::new(raw_proxy.clone(), path.clone()); - (self.store_proxy)(app_state, proxy); - xilem_core::MessageResult::Nop + let action = (self.store_proxy)(app_state, proxy); + xilem_core::MessageResult::Action(action) } else { let message = message.downcast::().unwrap(); - xilem_core::MessageResult::Action((self.handle_event)(app_state, *message)) + let action = (self.handle_event)(app_state, *message); + xilem_core::MessageResult::Action(action) } } }