Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Call initialize on the rendered element on AnyView

Antonio Scandurra66b520a51302
diff --git a/crates/gpui2/src/view.rs b/crates/gpui2/src/view.rs
index ff5f10e7224..f1d54e7ae01 100644
--- a/crates/gpui2/src/view.rs
+++ b/crates/gpui2/src/view.rs
@@ -316,9 +316,12 @@ impl<V: Render> From<View<V>> for AnyView {
initialize: |view, cx| {
cx.with_element_id(view.model.entity_id, |_, cx| {
let view = view.clone().downcast::<V>().unwrap();
- Box::new(AnyElement::new(
- view.update(cx, |view, cx| Render::render(view, cx)),
- ))
+ let element = view.update(cx, |view, cx| {
+ let mut element = AnyElement::new(view.render(cx));
+ element.initialize(view, cx);
+ element
+ });
+ Box::new(element)
})
},
layout: |view, element, cx| {