Skip to content

Conversation

@mikejoseph23
Copy link

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.vue wasn't properly handling nested folder structures. The recursive folder component wasn't being invoked for child folders.

Solution

Fixed the recursive folder rendering:

  • Updated treeFolder.vue to properly render child folders recursively
  • Adjusted the folder expansion/collapse logic to handle nested structures
  • Added proper depth tracking for nested folder indentation

Additional Changes

  • Added 20px bottom padding to <ul> elements in rendered markdown for better readability

Testing

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 rendering
  • src/renderer/src/components/sideBar/tree.vue - Updated folder tree structure
  • src/renderer/src/store/project.js - Fixed directory handling logic
  • src/renderer/src/store/treeCtrl.js - Improved tree control
  • src/muya/themes/default.css - Added ul padding
  • static/themes/default.css - Added ul padding

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Subdirectories not displaying in file explorer sidebar

1 participant