Fix panic when diagnostics first opens (#28935)

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2025-04-16 21:57:42 -06:00 committed by GitHub
parent a7a7335da4
commit ad25cd09b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -46,6 +46,7 @@ use workspace::{
actions!(diagnostics, [Deploy, ToggleWarnings]);
#[derive(Default)]
pub(crate) struct IncludeWarnings(bool);
impl Global for IncludeWarnings {}

View file

@ -95,9 +95,9 @@ impl Render for DiagnosticIndicator {
.on_click(cx.listener(|this, _, window, cx| {
if let Some(workspace) = this.workspace.upgrade() {
if this.summary.error_count == 0 && this.summary.warning_count > 0 {
cx.update_global(|show_warnings: &mut IncludeWarnings, _| {
show_warnings.0 = true
});
cx.update_default_global(
|show_warnings: &mut IncludeWarnings, _| show_warnings.0 = true,
);
}
workspace.update(cx, |workspace, cx| {
ProjectDiagnosticsEditor::deploy(