mirror of
https://git.meli.delivery/meli/meli
synced 2024-11-19 03:25:38 +00:00
state: remove overlay widgets on ComponentKill events
This commit is contained in:
parent
eb36034740
commit
4b91de3d59
@ -1174,14 +1174,16 @@ impl State {
|
||||
self.display_messages_pos = self.display_messages.len() - 1;
|
||||
self.redraw();
|
||||
}
|
||||
UIEvent::ComponentKill(ref id) if self.overlay.iter().any(|c| c.id() == *id) => {
|
||||
let pos = self.overlay.iter().position(|c| c.id() == *id).unwrap();
|
||||
self.overlay.remove(pos);
|
||||
}
|
||||
UIEvent::FinishedUIDialog(ref id, ref mut results)
|
||||
if self.overlay.iter().any(|c| c.id() == *id) =>
|
||||
{
|
||||
if let Some(ref mut action @ Some(_)) = results.downcast_mut::<Option<Action>>() {
|
||||
self.exec_command(action.take().unwrap());
|
||||
|
||||
let pos = self.overlay.iter().position(|c| c.id() == *id).unwrap();
|
||||
self.overlay.remove(pos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user