Closed dancespiele closed 3 years ago
You need to route the Command
returned by ConnectNode::update
all the way to your Application::update
, and return it there.
In other words, you are dropping the Command
here. Instead, you should write something like this:
fn update(&mut self, message: Self::Message) -> Command<Self::Message> {
match message {
Message::ConnectMessage(connect_node_msg) => {
self.connect_node.update(connect_node_msg).map(Message::ConnectMessage)
}
}
}
@hecrj I changed that https://github.com/dancespiele/okspiel/blob/master/src/main.rs#L47 however the async function https://github.com/dancespiele/okspiel/blob/master/src/connect/connect_node.rs#L231 is not executed according with the debugging when the button action is triggered
That's still not completely correct. You are discarding the Command
produced by ConnectNode::update
and returning Command::none
instead.
You need to remove the Command::none
line and the semicolon after the match
expression. You will end up with the function I wrote above.
yes thanks I didn't realize before.
I try to execute a Command for async function in Iced but look that it only works in parent component, in another component implement looks like doesn't work https://github.com/dancespiele/okspiel/blob/master/src/connect/connect_node.rs#L98
In that case how can I handle an asynchronize action in a child component?