refactor: dispatchers no longer go through async scheduling to improve reactivity

This commit is contained in:
sxyazi 2023-08-15 07:34:16 +08:00
parent edd0ad7997
commit a6d39dd28d
No known key found for this signature in database

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();