diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index ba3b9943713db2e0f26b464da21a26237dc13d6e..d5602b0d0913e4f22e0955b7561c7806c5f181bf 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -485,7 +485,7 @@ pub struct AgentPanel { } impl AgentPanel { - fn serialize(&mut self, cx: &mut Context) { + 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(); }