Ensure that new view observers are called by WindowContext::replace_root_view (#3730)

This fixes a bug where the window got into a bad, non-interactive state
when opening a project from an empty window.
This commit is contained in:
Max Brunsfeld 2023-12-19 17:16:30 -08:00 committed by GitHub
commit dfed171627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 12 deletions

View File

@ -1926,14 +1926,9 @@ impl VisualContext for WindowContext<'_> {
where
V: 'static + Render,
{
let slot = self.app.entities.reserve();
let view = View {
model: slot.clone(),
};
let mut cx = ViewContext::new(&mut *self.app, &mut *self.window, &view);
let entity = build_view(&mut cx);
self.entities.insert(slot, entity);
let view = self.build_view(build_view);
self.window.root_view = Some(view.clone().into());
self.notify();
view
}

View File

@ -600,11 +600,6 @@ impl Workspace {
let modal_layer = cx.build_view(|_| ModalLayer::new());
// todo!()
// cx.update_default_global::<DragAndDrop<Workspace>, _, _>(|drag_and_drop, _| {
// drag_and_drop.register_container(weak_handle.clone());
// });
let mut active_call = None;
if cx.has_global::<Model<ActiveCall>>() {
let call = cx.global::<Model<ActiveCall>>().clone();