Yuki Takei 4 месяцев назад
Родитель
Сommit
a5fcb0ac4e

+ 2 - 2
apps/app/src/features/page-tree/client/hooks/use-auto-expand-ancestors.ts

@@ -12,7 +12,7 @@ type UseAutoExpandAncestorsProps = {
 
 /**
  * Get all ancestor paths for a given target path
- * e.g., "/Sandbox/Diagrams/print-test" => ["/Sandbox", "/Sandbox/Diagrams"]
+ * e.g., "/Sandbox/Diagrams/figure-1" => ["/Sandbox", "/Sandbox/Diagrams"]
  */
 export const getAncestorPaths = (targetPath: string): string[] => {
   const segments = targetPath.split('/').filter(Boolean);
@@ -20,7 +20,7 @@ export const getAncestorPaths = (targetPath: string): string[] => {
 
   // Build ancestor paths (excluding the target itself)
   for (let i = 0; i < segments.length - 1; i++) {
-    ancestors.push('/' + segments.slice(0, i + 1).join('/'));
+    ancestors.push(`/${segments.slice(0, i + 1).join('/')}`);
   }
 
   return ancestors;