agent_ui: Fix panic when resizing panel (#48772)

- [X] Code Reviewed
- [X] Manual QA

Release Notes:

- N/A
This commit is contained in:
Finn Evers authored and GitHub committed 2026-02-09 10:36:11 +00:00
1 parent 08482e2335
commit 2ca0390931
1 file changed
+9 -2
+9 -2
View File
@@ -485,7 +485,7 @@ pub struct AgentPanel {
}
impl AgentPanel {
fn serialize(&mut self, cx: &mut Context<Self>) {
fn serialize(&mut self, cx: &mut App) {
let workspace_id = self
.workspace
.read_with(cx, |workspace, _| workspace.database_id())
@@ -1894,7 +1894,14 @@ impl Panel for AgentPanel {
DockPosition::Left | DockPosition::Right => self.width = size,
DockPosition::Bottom => self.height = size,
}
self.serialize(cx);
let this = cx.weak_entity();
cx.defer(move |cx| {
if let Some(this) = this.upgrade() {
this.update(cx, |this, cx| {
this.serialize(cx);
});
}
});
cx.notify();
}