Do not query db on foreground thread.

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Piotr Osiewicz 2023-06-29 19:07:51 +02:00
parent 818ddbc703
commit 081e340d26
2 changed files with 30 additions and 22 deletions

View file

@ -66,17 +66,9 @@ fn toggle(
pub fn build_recent_projects(
workspace: WeakViewHandle<Workspace>,
workspaces: Vec<WorkspaceLocation>,
cx: &mut ViewContext<RecentProjects>,
) -> RecentProjects {
let workspaces = futures::executor::block_on(async {
WORKSPACE_DB
.recent_workspaces_on_disk()
.await
.unwrap_or_default()
.into_iter()
.map(|(_, location)| location)
.collect()
});
Picker::new(RecentProjectsDelegate::new(workspace, workspaces), cx)
.with_theme(|theme| theme.picker.clone())
}