remote_server: Fix opening a new remote project not refreshing the project panel (#18262)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run

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