refactor: dispatchers no longer go through async scheduling to improve reactivity (#60)

This commit is contained in:
三咲雅 · Misaki Masa 2023-08-15 07:34:52 +08:00 committed by GitHub
parent edd0ad7997
commit 8fd3d15918
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,7 +35,7 @@ impl App {
Event::Resize(..) => app.dispatch_resize(),
Event::Stop(state, tx) => app.dispatch_stop(state, tx),
Event::Ctrl(ctrl, layer) => app.dispatch_ctrl(ctrl, layer),
event => app.dispatch_module(event).await,
event => app.dispatch_module(event),
}
}
Ok(())
@ -107,12 +107,14 @@ impl App {
}
}
async fn dispatch_module(&mut self, event: Event) {
fn dispatch_module(&mut self, event: Event) {
let manager = &mut self.cx.manager;
let tasks = &mut self.cx.tasks;
match event {
Event::Cd(path) => {
manager.active_mut().cd(absolute_path(path).await).await;
futures::executor::block_on(async {
manager.active_mut().cd(absolute_path(path).await).await;
});
}
Event::Refresh => {
manager.refresh();