When there are many folder notes, the bottom notes are not shown in the File Tree
Describe the bug With Hide Folder Note: enabled and Storage location: in the parent folder
I have many folder notes and when scrolling in some places, esp. after a lot of folder notes followed by non-folder note files, the files at the bottom of the tree are not shown.
Possible cause: when Hide Folder Note is enabled, a lot of files are not displayed, and the files/folders more at the bottom are displayed instead. However, I suspect that Obsidian doesn't load all of them for memory considerations. As a result, past a certain number of files, the file titles stop showing completely.
Storage location: in the parent folder is in theory not required but when storing Index.md inside folder, you have to open said folder to display Index.md and make Hide Folder Note setting hide it so you'd have to open many folder notes to reproduce the bug (only a theory, I did not verify in practice), so storing same-name note in parent folder should be easier as you can just keep the folder notes collapsed.
Steps to Reproduce Unfortunately, I have troubles reproducing the bug in the Sandbox Vault. I thought I barely got a single line hidden with Storage location: in the parent folder and I'm not sure it wasn't just a temporary glitch. It seems that you need many notes and even duplicating a lot of them in the Sandbox Vault wasn't enough.
Steps to reproduce the behavior:
- Set option Hide Folder Note: enabled (and preferably Storage location: in the parent folder)1.
- Create a vault with many wild notes and folder notes (and children)
- Open folders at some levels to reveal more notes. The more underlined folder notes, the fewer wild notes at the top, the better. But keep wild (non-underlined) notes at the bottom
- Scroll until you see wild notes at the bottom not being shown
- Scroll more to see fluctuations in the number of files not being shown
Expected behavior All notes should be shown in the file tree
Screenshots If applicable, add screenshots to help explain your problem.
Obsidian version
- Installer version: v1.8.10
- Current version: v1.8.10
Plugin information
- Version: v1.8.16
- [ ] Beta version
Additional context If you cannot create a complex structure like mine, I can think of writing a Python script that would copy just the structure (folder + .md) without any content so I can share an anonymized MWE (but I haven't done it yet, otherwise I would have tried it in my Sandbox vault). Tell me if you have a big sample to test on already.
I've asked chatgpt for a python script that does that and I've tried it already and it works.
import os
import shutil
def copy_md_structure(src_dir, dst_dir, ignore_folders=None):
"""
Replicates the folder structure from src_dir to dst_dir,
creates empty .md files for each .md file in the source,
and ignores specific folders like .obsidian and .trash.
"""
src_dir = os.path.abspath(src_dir)
dst_dir = os.path.abspath(dst_dir)
ignore_folders = set(ignore_folders or [])
for root, dirs, files in os.walk(src_dir):
# Remove ignored folders from traversal
dirs[:] = [d for d in dirs if d not in ignore_folders]
# Figure out where this folder should go in dst_dir
relative_path = os.path.relpath(root, src_dir)
target_folder = os.path.join(dst_dir, relative_path)
# Create folder in the destination
os.makedirs(target_folder, exist_ok=True)
# Create empty .md files in that folder
for file in files:
if file.lower().endswith(".md"):
target_file = os.path.join(target_folder, file)
open(target_file, "w").close()
if __name__ == "__main__":
source = "original folder path"
destination = "new folder path"
if os.path.exists(destination):
shutil.rmtree(destination) # start clean
copy_md_structure(source, destination, ignore_folders=[".obsidian", ".trash"])
print(f"Anonymized structure copied to: {destination}")
I don't have a vault with that many files so that would great if you could do that.
This issue is affects me as well, so I decided to create a repro vault: https://github.com/voytxt/obsidian-folder-notes-bug-repro
https://github.com/user-attachments/assets/3be58628-a783-44e5-bf4d-20263198cb9f
You can also completely delete the .obsidian folder, and then the repro goes as follows:
- Install and enable the Folder Notes plugin.
- Go to options for Folder Notes and for Storage location, select "In the parent folder" and hit Switch and Confirm.
- Restart Obsidian.
Putting this
setTimeout(() => {
// @ts-ignore
this.app.workspace.getLeavesOfType('file-explorer')[0].view.tree.infinityScroll.rootMargin = 100;
}, 1000);
in the onload function, fixes the issue.
I also made a fork, where it's fixed, but note that it's very barebones and opinionated, with no customization whatsoever.