mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 13:10:54 +00:00
Avoid holding RefCell borrow while calling TestAppContext::spawn callback
This commit is contained in:
parent
7ef9de32b1
commit
8d46edd26c
1 changed files with 8 additions and 1 deletions
|
@ -499,7 +499,14 @@ impl TestAppContext {
|
|||
Fut: 'static + Future<Output = T>,
|
||||
T: 'static,
|
||||
{
|
||||
self.cx.borrow_mut().spawn(f)
|
||||
let foreground = self.foreground();
|
||||
let future = f(self.to_async());
|
||||
let cx = self.to_async();
|
||||
foreground.spawn(async move {
|
||||
let result = future.await;
|
||||
cx.0.borrow_mut().flush_effects();
|
||||
result
|
||||
})
|
||||
}
|
||||
|
||||
pub fn simulate_new_path_selection(&self, result: impl FnOnce(PathBuf) -> Option<PathBuf>) {
|
||||
|
|
Loading…
Reference in a new issue