Skip to content

Commit

Permalink
remote_server: Fix opening a new remote project not refreshing the pr…
Browse files Browse the repository at this point in the history
…oject 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.
  • Loading branch information
CharlesChen0823 authored Sep 25, 2024
1 parent 9a86012 commit e9bc9ed
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions crates/workspace/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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?
Expand All @@ -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)
})
Expand Down

0 comments on commit e9bc9ed

Please sign in to comment.