Don't construct an agent panel when disable_ai is set (#39689)

Follow-up to #39649, possible fix for #39669

This implements an alternate strategy for showing/hiding the agent panel
in response to `disable_ai`. We don't load the panel at all if AI is
disabled at startup, and when the value of `disable_ai` changes, we load
the panel or destroy it as needed.

Release Notes:

- N/A
This commit is contained in:
Cole Miller
2025-10-07 12:48:37 -04:00
committed by GitHub
parent f9a2724a8b
commit d04ac864b8
3 changed files with 64 additions and 61 deletions
+13
View File
@@ -1748,6 +1748,19 @@ impl Workspace {
});
}
pub fn remove_panel<T: Panel>(
&mut self,
panel: &Entity<T>,
window: &mut Window,
cx: &mut Context<Self>,
) {
for dock in [&self.left_dock, &self.bottom_dock, &self.right_dock] {
dock.update(cx, |dock, cx| {
dock.remove_panel(panel, window, cx);
})
}
}
pub fn status_bar(&self) -> &Entity<StatusBar> {
&self.status_bar
}