Repository navigation
Conversation
This commit fixes a critical bug where subdirectories were not appearing in the file explorer sidebar when expanding folders, while files displayed correctly. Changes: - Add missing self-import to treeFolder.vue for recursive rendering (Vue 3 script setup requires explicit imports including self-references) - Use local reactive state for isCollapsed to properly track folder expansion state - Change v-if to v-show for folder-contents to maintain DOM presence - Use proper v-for keys based on item IDs instead of array indexes - Implement alphabetical sorting for folders in addDirectory - Add event buffering for directory changes before tree initialization - Extract _processTreeEvent method for cleaner event handling Root cause: The recursive Folder component was referenced in the template as <folder> but was never imported in the script setup section, causing Vue to fail silently when trying to render nested folder components. Testing: Verified that subdirectories now render correctly when expanding folders in the sidebar, while maintaining proper file display and folder state persistence.
Tkaixiang
left a comment
There was a problem hiding this comment.
Thanks for the PR :), left some comments mainly regarding code quality/performance concerns
| <div v-show="!isCollapsed" class="folder-contents"> | ||
| <Folder | ||
| v-for="childFolder of folder.folders" | ||
| :key="childFolder.id" | ||
| :folder="childFolder" | ||
| :depth="depth + 1" | ||
| ></folder> | ||
| ></Folder> |
There was a problem hiding this comment.
Is there a reason why v-show was used over v-if? This means the entire tree is rendered at any-time instead of conditional rendering, which can cause lag for big folders
| @@ -89,7 +94,7 @@ const handleInputFocus = () => { | |||
| input.value.focus() | |||
| createName.value = '' | |||
| if (props.folder) { | |||
| // eslint-disable-next-line vue/no-mutating-props | |||
| isCollapsed.value = false | |||
| props.folder.isCollapsed = false | |||
| } | |||
| } | |||
| @@ -101,8 +106,8 @@ const handleInputEnter = () => { | |||
| } | |||
|
|
|||
| const folderNameClick = () => { | |||
| // eslint-disable-next-line vue/no-mutating-props | |||
| props.folder.isCollapsed = !props.folder.isCollapsed | |||
| isCollapsed.value = !isCollapsed.value | |||
| props.folder.isCollapsed = isCollapsed.value | |||
| } | |||
There was a problem hiding this comment.
If we are using a local reactive variable to track the collapsible state (which is good), shouldn't we remove the props.folder.isCollapsed mutation then?
| import bus from '../../bus' | ||
| import File from './treeFile.vue' | ||
| // Import self for recursive rendering | ||
| import Folder from './treeFolder.vue' |
There was a problem hiding this comment.
I do not think you need to import itself? It is more of we need to change the name to <tree-folder> if we want to still use TreeFolder
| @media not print { | ||
| #ag-editor-id { | ||
| max-width: var(--editorAreaWidth); | ||
| max-width: 100%; |
There was a problem hiding this comment.
Is there a reason for this change? it seems unrelated to this PR, and causes the editor to stretch out to the entire screen on ultra wide monitors.
| @media not print { | ||
| #ag-editor-id { | ||
| max-width: var(--editorAreaWidth); | ||
| max-width: 100%; |
There was a problem hiding this comment.
Is there a reason for this change? it seems unrelated to this PR, and causes the editor to stretch out to the entire screen on ultra wide monitors. [Same as below for the .css file comment]
|
Will be taking this PR in for fixes in a seperate branch first before merging into |
|
You're welcome. Sorry I didn't reply sooner. |
Fixes #26
Problem
Subdirectories are not displaying recursively in the file explorer sidebar. Only the first level of folders is expandable, but any sub-folders underneath are not listed even though they exist in the filesystem.
Root Cause
The folder tree rendering logic in
treeFolder.vuewasn't properly handling nested folder structures. The recursive folder component wasn't being invoked for child folders.Solution
Fixed the recursive folder rendering:
treeFolder.vueto properly render child folders recursivelyAdditional Changes
<ul>elements in rendered markdown for better readabilityTesting
Tested on macOS with deeply nested folder structures. All subdirectories now display correctly and can be expanded/collapsed as expected.
Files Changed
src/renderer/src/components/sideBar/treeFolder.vue- Fixed recursive folder renderingsrc/renderer/src/components/sideBar/tree.vue- Updated folder tree structuresrc/renderer/src/store/project.js- Fixed directory handling logicsrc/renderer/src/store/treeCtrl.js- Improved tree controlsrc/muya/themes/default.css- Added ul paddingstatic/themes/default.css- Added ul padding