diff --git a/src/ui/dummy.rs b/src/ui/dummy.rs index 05a02a7..5c50134 100644 --- a/src/ui/dummy.rs +++ b/src/ui/dummy.rs @@ -1,4 +1,4 @@ -use crate::event::Event; +use crate::event::{AppEvent, Event}; pub(crate) struct DummyUI {} @@ -14,7 +14,11 @@ impl super::UI for DummyUI { _tx: tokio::sync::mpsc::UnboundedSender, mut rx: tokio::sync::mpsc::UnboundedReceiver, ) -> color_eyre::Result<()> { - while rx.recv().await.is_some() {} + while let Some(event) = rx.recv().await { + if let Event::App(AppEvent::Done) = event { + break; + } + } Ok(()) } } diff --git a/src/ui/logger.rs b/src/ui/logger.rs index 460f44f..ed54800 100644 --- a/src/ui/logger.rs +++ b/src/ui/logger.rs @@ -1,4 +1,4 @@ -use crate::event::Event; +use crate::event::{AppEvent, Event}; pub(crate) struct LoggerUI {} @@ -17,7 +17,11 @@ impl super::UI for LoggerUI { _tx: tokio::sync::mpsc::UnboundedSender, mut rx: tokio::sync::mpsc::UnboundedReceiver, ) -> color_eyre::Result<()> { - while rx.recv().await.is_some() {} + while let Some(event) = rx.recv().await { + if let Event::App(AppEvent::Done) = event { + break; + } + } Ok(()) } }