Do not query db on foreground thread.
Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
818ddbc703
commit
081e340d26
2 changed files with 30 additions and 22 deletions
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue