diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index f60cb645b36906560c1b4a4f04f2e878b15e10e4..bc8dcb38f1bf5cf5f2e8617b0f4ea1860db54a71 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -1055,16 +1055,17 @@ impl ProjectSearchView { let is_dirty = self.is_dirty(cx); - let skip_save_on_close = self - .workspace - .read_with(cx, |workspace, cx| { - workspace::Pane::skip_save_on_close(&self.results_editor, workspace, cx) - }) - .unwrap_or(false); + cx.spawn_in(window, async move |this, cx| { + let skip_save_on_close = this + .read_with(cx, |this, cx| { + this.workspace.read_with(cx, |workspace, cx| { + workspace::Pane::skip_save_on_close(&this.results_editor, workspace, cx) + }) + })? + .unwrap_or(false); - let should_prompt_to_save = !skip_save_on_close && !will_autosave && is_dirty; + let should_prompt_to_save = !skip_save_on_close && !will_autosave && is_dirty; - cx.spawn_in(window, async move |this, cx| { let should_search = if should_prompt_to_save { let options = &["Save", "Don't Save", "Cancel"]; let result_channel = this.update_in(cx, |_, window, cx| {