Merge pull request #1718 from zed-industries/dont-wait-for-project-upload

Proceed with share while project state uploads
This commit is contained in:
Max Brunsfeld 2022-10-11 12:48:33 -07:00 committed by GitHub
commit 9bdcd37f60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 20 deletions

View File

@ -398,11 +398,11 @@ impl Room {
cx.spawn(|this, mut cx| async move { cx.spawn(|this, mut cx| async move {
let response = request.await?; let response = request.await?;
project.update(&mut cx, |project, cx| {
project project
.update(&mut cx, |project, cx| { .shared(response.project_id, cx)
project.shared(response.project_id, cx) .detach_and_log_err(cx)
}) });
.await?;
// If the user's location is in this project, it changes from UnsharedProject to SharedProject. // If the user's location is in this project, it changes from UnsharedProject to SharedProject.
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {

View File

@ -3874,6 +3874,7 @@ async fn test_language_server_statuses(
.update(cx_a, |call, cx| call.share_project(project_a.clone(), cx)) .update(cx_a, |call, cx| call.share_project(project_a.clone(), cx))
.await .await
.unwrap(); .unwrap();
deterministic.run_until_parked();
let project_b = client_b.build_remote_project(project_id, cx_b).await; let project_b = client_b.build_remote_project(project_id, cx_b).await;
project_b.read_with(cx_b, |project, _| { project_b.read_with(cx_b, |project, _| {
let status = project.language_server_statuses().next().unwrap(); let status = project.language_server_statuses().next().unwrap();

View File

@ -65,7 +65,6 @@ enum ContactEntry {
project_id: u64, project_id: u64,
worktree_root_names: Vec<String>, worktree_root_names: Vec<String>,
host_user_id: u64, host_user_id: u64,
is_host: bool,
is_last: bool, is_last: bool,
}, },
IncomingRequest(Arc<User>), IncomingRequest(Arc<User>),
@ -181,6 +180,7 @@ impl ContactList {
let list_state = ListState::new(0, Orientation::Top, 1000., cx, move |this, ix, cx| { let list_state = ListState::new(0, Orientation::Top, 1000., cx, move |this, ix, cx| {
let theme = cx.global::<Settings>().theme.clone(); let theme = cx.global::<Settings>().theme.clone();
let is_selected = this.selection == Some(ix); let is_selected = this.selection == Some(ix);
let current_project_id = this.project.read(cx).remote_id();
match &this.entries[ix] { match &this.entries[ix] {
ContactEntry::Header(section) => { ContactEntry::Header(section) => {
@ -205,13 +205,12 @@ impl ContactList {
project_id, project_id,
worktree_root_names, worktree_root_names,
host_user_id, host_user_id,
is_host,
is_last, is_last,
} => Self::render_participant_project( } => Self::render_participant_project(
*project_id, *project_id,
worktree_root_names, worktree_root_names,
*host_user_id, *host_user_id,
*is_host, Some(*project_id) == current_project_id,
*is_last, *is_last,
is_selected, is_selected,
&theme.contact_list, &theme.contact_list,
@ -341,16 +340,13 @@ impl ContactList {
ContactEntry::ParticipantProject { ContactEntry::ParticipantProject {
project_id, project_id,
host_user_id, host_user_id,
is_host,
.. ..
} => { } => {
if !is_host {
cx.dispatch_global_action(JoinProject { cx.dispatch_global_action(JoinProject {
project_id: *project_id, project_id: *project_id,
follow_user_id: *host_user_id, follow_user_id: *host_user_id,
}); });
} }
}
_ => {} _ => {}
} }
} }
@ -407,7 +403,6 @@ impl ContactList {
project_id: project.id, project_id: project.id,
worktree_root_names: project.worktree_root_names.clone(), worktree_root_names: project.worktree_root_names.clone(),
host_user_id: user_id, host_user_id: user_id,
is_host: true,
is_last: projects.peek().is_none(), is_last: projects.peek().is_none(),
}); });
} }
@ -448,7 +443,6 @@ impl ContactList {
project_id: project.id, project_id: project.id,
worktree_root_names: project.worktree_root_names.clone(), worktree_root_names: project.worktree_root_names.clone(),
host_user_id: participant.user.id, host_user_id: participant.user.id,
is_host: false,
is_last: projects.peek().is_none(), is_last: projects.peek().is_none(),
}); });
} }
@ -667,7 +661,7 @@ impl ContactList {
project_id: u64, project_id: u64,
worktree_root_names: &[String], worktree_root_names: &[String],
host_user_id: u64, host_user_id: u64,
is_host: bool, is_current: bool,
is_last: bool, is_last: bool,
is_selected: bool, is_selected: bool,
theme: &theme::ContactList, theme: &theme::ContactList,
@ -749,13 +743,13 @@ impl ContactList {
.with_style(row.container) .with_style(row.container)
.boxed() .boxed()
}) })
.with_cursor_style(if !is_host { .with_cursor_style(if !is_current {
CursorStyle::PointingHand CursorStyle::PointingHand
} else { } else {
CursorStyle::Arrow CursorStyle::Arrow
}) })
.on_click(MouseButton::Left, move |_, cx| { .on_click(MouseButton::Left, move |_, cx| {
if !is_host { if !is_current {
cx.dispatch_global_action(JoinProject { cx.dispatch_global_action(JoinProject {
project_id, project_id,
follow_user_id: host_user_id, follow_user_id: host_user_id,