remote_server: Fix opening a new remote project not refreshing the project panel (#18262)

Currently, when open new remote project, project_panel not refresh, we
must `ctrl-p` and select an file to refresh the project_panel. After
that, project_panel will refresh when remote project window active.

Release Notes:

- Fixed remote projects not restoring previous locations and not
refreshing the project panel on open.
This commit is contained in:
CharlesChen0823 2024-09-25 16:00:17 +08:00 committed by GitHub
parent 9a8601227d
commit e9bc9ed5d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5607,6 +5607,9 @@ pub fn join_dev_server_project(
}) })
}); });
let serialized_workspace: Option<SerializedWorkspace> =
persistence::DB.workspace_for_dev_server_project(dev_server_project_id);
let workspace = if let Some(existing_workspace) = existing_workspace { let workspace = if let Some(existing_workspace) = existing_workspace {
existing_workspace existing_workspace
} else { } else {
@ -5620,10 +5623,7 @@ pub fn join_dev_server_project(
) )
.await?; .await?;
let serialized_workspace: Option<SerializedWorkspace> = let workspace_id = if let Some(ref serialized_workspace) = serialized_workspace {
persistence::DB.workspace_for_dev_server_project(dev_server_project_id);
let workspace_id = if let Some(serialized_workspace) = serialized_workspace {
serialized_workspace.id serialized_workspace.id
} else { } else {
persistence::DB.next_id().await? persistence::DB.next_id().await?
@ -5650,10 +5650,13 @@ pub fn join_dev_server_project(
} }
}; };
workspace.update(&mut cx, |_, cx| { workspace
cx.activate(true); .update(&mut cx, |_, cx| {
cx.activate_window(); cx.activate(true);
})?; cx.activate_window();
open_items(serialized_workspace, vec![], app_state, cx)
})?
.await?;
anyhow::Ok(workspace) anyhow::Ok(workspace)
}) })