Fix filetree SSR tab selection

This commit is contained in:
lix-2026
2026-05-26 14:34:47 +08:00
parent 4744757883
commit f961c1e2a1
5 changed files with 94 additions and 5 deletions
@@ -49,6 +49,7 @@ pub struct DocumentShellQuery {
pub workspace_id: Option<String>,
pub source_kind: Option<String>,
pub root_uri: Option<String>,
pub tree_view: Option<String>,
pub secondary_document_id: Option<String>,
pub secondary_source_kind: Option<String>,
pub secondary_root_uri: Option<String>,
@@ -142,6 +143,11 @@ pub async fn document_page_shell(
.map(str::trim)
.filter(|value| !value.is_empty())
== Some("local_folder");
let requests_filetree_first = query
.tree_view
.as_deref()
.map(str::trim)
.is_some_and(|value| value == "filetree");
let (sidebar_tree_html, file_tree_html) = if is_local_folder {
let root_uri = query.root_uri.as_deref().unwrap_or_default();
(
@@ -168,6 +174,11 @@ pub async fn document_page_shell(
&workspace_projection,
Some(sidebar_tree_html.as_str()),
Some(file_tree_html.as_str()),
if requests_filetree_first {
Some("filetree")
} else {
None
},
);
let workspace_name = workspace_projection.workspace_name.clone();
let page_subtree_json =