-
Notifications
You must be signed in to change notification settings - Fork 157
Description
Intuitively, returning () or None from future passed to orders.perform_cmd(...) means that no message should be sent to Seed mailbox.
Similarly, orders.msg_sender()(None) should not send any message.
And in these cases rerender should not be triggered.
But it is done differently. This is stated in documentation of seed::app::App::update_with_option.
However from library user perspective there's no connection between update_with_option and perform_cmd.
I think, we should at least state this fact in documentation of perform_cmd and msg_sender, so other library users won't be surprised like I was and won't have to spend time on debugging like I had to.
My code looked like:
fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
match msg {
Msg::MyMsg => {
orders.perform_cmd(async move { /* do sth that do not require rerender */; });
orders.after_next_render(|_| Msg::MyMsg);
orders.skip();
}
}
}After finishing async move { ... }, rendering is performed and async move { ... } is started again.