mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 11:01:54 +00:00
Flush effects after every spawned future completes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
34e42c0c5f
commit
f1fc0bde99
1 changed files with 6 additions and 1 deletions
|
@ -1653,8 +1653,13 @@ impl MutableAppContext {
|
|||
Fut: 'static + Future<Output = T>,
|
||||
T: 'static,
|
||||
{
|
||||
let future = f(self.to_async());
|
||||
let cx = self.to_async();
|
||||
self.foreground.spawn(f(cx))
|
||||
self.foreground.spawn(async move {
|
||||
let result = future.await;
|
||||
cx.0.borrow_mut().flush_effects();
|
||||
result
|
||||
})
|
||||
}
|
||||
|
||||
pub fn to_async(&self) -> AsyncAppContext {
|
||||
|
|
Loading…
Reference in a new issue