Use AppContext::update when updating windows so we handle effects
This commit is contained in:
parent
8e49d1419a
commit
fc96676662
1 changed files with 9 additions and 7 deletions
|
@ -2112,13 +2112,15 @@ impl BorrowWindowContext for AppContext {
|
||||||
where
|
where
|
||||||
F: FnOnce(&mut WindowContext) -> T,
|
F: FnOnce(&mut WindowContext) -> T,
|
||||||
{
|
{
|
||||||
let mut window = self.windows.remove(&handle)?;
|
self.update(|cx| {
|
||||||
let mut window_context = WindowContext::mutable(self, &mut window, handle);
|
let mut window = cx.windows.remove(&handle)?;
|
||||||
let result = f(&mut window_context);
|
let mut window_context = WindowContext::mutable(cx, &mut window, handle);
|
||||||
if !window_context.removed {
|
let result = f(&mut window_context);
|
||||||
self.windows.insert(handle, window);
|
if !window_context.removed {
|
||||||
}
|
cx.windows.insert(handle, window);
|
||||||
Some(result)
|
}
|
||||||
|
Some(result)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_window_optional<T, F>(&mut self, handle: AnyWindowHandle, f: F) -> Option<T>
|
fn update_window_optional<T, F>(&mut self, handle: AnyWindowHandle, f: F) -> Option<T>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue