Repository navigation
Commit 2cdd153
committed
fix(web): set correct intermediate directory paths in buildFileTree
When constructing the file tree from a flat list in buildFileTree, new intermediate directory nodes were assigned item.path (the path of the leaf item being processed) instead of their actual directory path.
This caused intermediate directory nodes to have full file paths instead of their directory path (e.g. directory 'src' receiving path 'src/components/Button.tsx'), breaking folder expansion state tracking (openPaths.has(node.path)) and corrupting directory paths returned by getTree.
Reconstruct the node path using parts.slice(0, i + 1).join('/') so both directories and leaves have the correct path.1 parent 390e8b2 commit 2cdd153
2 files changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
0 commit comments