File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed
Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -82,17 +82,18 @@ function isNodeActive(node: DiffTreeNode): boolean {
8282
8383const expandedDirs = ref <Set <string >>(new Set ())
8484
85- // Auto-expand all directories on mount (only at root level)
86- onMounted (() => {
87- if (props .depth === undefined || props .depth === 0 ) {
88- function collectDirs(nodes : DiffTreeNode []) {
89- for (const node of nodes ) {
90- if (node .type === ' directory' ) {
91- expandedDirs .value .add (node .path )
92- if (node .children ) collectDirs (node .children )
93- }
94- }
85+ function collectDirs(nodes : DiffTreeNode []) {
86+ for (const node of nodes ) {
87+ if (node .type === ' directory' ) {
88+ expandedDirs .value .add (node .path )
89+ if (node .children ) collectDirs (node .children )
9590 }
91+ }
92+ }
93+
94+ // Auto-expand all directories eagerly (runs on both SSR and client)
95+ watchEffect (() => {
96+ if (props .depth === undefined || props .depth === 0 ) {
9697 collectDirs (tree .value )
9798 }
9899})
You can’t perform that action at this time.
0 commit comments