Fix circular reference issue around PopoverMenu (#42461)

Follow up to https://github.com/zed-industries/zed/pull/42351

Release Notes:

- N/A
This commit is contained in:
feeiyu
2025-11-11 19:20:38 +02:00
committed by GitHub
parent c50f821613
commit 5f4d0dbaab
2 changed files with 21 additions and 12 deletions
+7 -2
View File
@@ -1053,11 +1053,16 @@ impl Render for LspButton {
(None, "All Servers Operational")
};
let lsp_button = cx.entity();
let lsp_button = cx.weak_entity();
div().child(
PopoverMenu::new("lsp-tool")
.menu(move |_, cx| lsp_button.read(cx).lsp_menu.clone())
.menu(move |_, cx| {
lsp_button
.read_with(cx, |lsp_button, _| lsp_button.lsp_menu.clone())
.ok()
.flatten()
})
.anchor(Corner::BottomLeft)
.with_handle(self.popover_menu_handle.clone())
.trigger_with_tooltip(