From 8fd3d15918b9ebba127fe11cff38b1bb73393f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Tue, 15 Aug 2023 07:34:52 +0800 Subject: [PATCH] refactor: dispatchers no longer go through async scheduling to improve reactivity (#60) --- app/src/app.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/app.rs b/app/src/app.rs index 472e06b2..d59fd759 100644 --- a/app/src/app.rs +++ b/app/src/app.rs @@ -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();