SebastianMC / obsidian-custom-sort

Take full control over the order and sorting of folders and notes in File Explorer in Obsidian
GNU General Public License v3.0
252 stars 19 forks source link

Files and subfolders will no longer display in folders on v1.5.8 #135

Closed dustincoates closed 4 months ago

dustincoates commented 4 months ago

With version 1.5.8, files and subfolders will no longer display when trying to expand the parent folders.

For example, with the following structure:

  |
  | - B
      | - file-b-md
  | file.md

When expanding A, you will not see B or file.md.

I have confirmed that this is due to the custom sort plugin by disabling it and restarting Obsidian.

jmatsushita commented 4 months ago

Same problem here. I think A in @dustincoates 's example is:

A
├── B
│   └─ file-b.md
└── file.md

Basically, only folders (and files) directly under the space's root are displayed, clicking on them doesn't open them.

jmatsushita commented 4 months ago

The console displays the following error:

Uncaught TypeError: Cannot read properties of undefined (reading 'sortOrder')
    at t.Vt (plugin:custom-sort:6:10111)
    at t.eval (plugin:custom-sort:42:7319)
    at t.a [as sort] (plugin:custom-sort:6:802)
    at t.sort (app.js:1:2421435)
    at app.js:1:2774004
    at e.onNextFrame (app.js:1:2773879)
SebastianMC commented 4 months ago

Hi @dustincoates, @jmatsushita,

thanks for reporting the problem! To complete this bug context please post here the information about your platform (windows / linux / macos / mobile) and the version of the custom-sort plugin

I'm asking for the additional details because the described behavior resembles a known incompatibility with Obsidian, which was addressed in 2.1.7 release of the plugin (the newest release for now is 2.1.8) - maybe there are scenarios / cases which are not covered by the fix.

Knowing the environment on your side I should be able to reproduce the problem.

JeNeSuisPasDave commented 4 months ago

Hi @dustincoates, @jmatsushita,

thanks for reporting the problem! To complete this bug context please post here the information about your platform (windows / linux / macos / mobile) and the version of the custom-sort plugin

I'm asking for the additional details because the described behavior resembles a known incompatibility with Obsidian, which was addressed in 2.1.7 release of the plugin (the newest release for now is 2.1.8) - maybe there are scenarios / cases which are not covered by the fix.

Knowing the environment on your side I should be able to reproduce the problem.

I have the same issue. custom-sort version 2.1.8; Obsidian 1.5.8; OS is macos 14.3.1.

I have to disable the custom-sort plugin in order to see contents of subfolders level 3 and lower.

SebastianMC commented 4 months ago

Hi @JeNeSuisPasDave

unfortunately I don't have the macos 14.x at hand to test in exactly the same environment.

The issue seems tricky :-(

Could you please tell me the installer version, in addition to the Obsidian 1.5.8? Sometimes an old installer can cause problems.

I definitely need help from you, and/or @dustincoates , @jmatsushita:

As you probably guess, the problem is not observable on my side (unfortunately) Macos 13.6.3 and two other machines with older versions, intels and mac silicon A fresh install of Obsidian and also installations with an older installer Simple isolated vaults created for testing and also large vaults of real-life content Various combinations of plugins, various combinations of sorting methods In all these cases the plugin behaves correctly

There must be some factor which causes the problem on your environments Maybe it is related to language settings? Maybe something else.

I'd appreciate your help in identifying the problem! And the very first step is - as I described above - to see if an isolated new vault, created from scratch, with a simplistic folders structure and only the custom-sort plugin, if the problem is reproducible. Plus the versions information, including the version of the installer

thanks in advance!

AndreiSager commented 4 months ago

This also happened for me. I found a way to fix it the day it broke.

All you have to do is update the plugin in your vault. Make sure it is up to date.

image

You can update all your plugins at the same time.

image

Or you can update a plugin directly.

image

I hope this helps :)

zakhar9lov commented 4 months ago

I ran into the same problem yesterday:

  1. New directories and notes were not displayed in the tree, but were displayed in the system itself.
  2. Disabling Custom File Explorer sorting solved the problem.
  3. If you enable the plugin again, the problem was solved temporarily, but after a few minutes of operation, new directories and files were not displayed again.
  4. If you create a new vault and install only the sorting plugin, the problem did not appear. But I didn't spend enough time in the new vault.
  5. After updating the plugin, all missing directories and files began to be displayed

Updating the plugin solved the problem

SebastianMC commented 4 months ago

Thank you @Andrei-Sager and @zakhar9lov for the details and suggestions! I don't know if this helps @dustincoates and @jmatsushita, who originally reported the problem here. They didn't include versions information, so can't tell if the suggestions are applicable or not

Let me recap and give more context to this issue

Obsidian in version 1.5.4 introduced some internal breaking changes which caused the custom-sort plugin to stop working. The symptoms (described in #131) were similar to what is reported under this ticket. That's why my first thoughts revolved around #131 and plugin release 2.1.7 as a potential remedy.

I asked the reporters for the missing versions information and at that point @JeNeSuisPasDave joined with details - Obsidian 1.5.8, custom-sort 2.1.8 and the problem observable on his machine.

Now waiting for further input from the original reporters (versions information). And/or for more information and help from @JeNeSuisPasDave, whose report is most concerning here. It suggests that with the newest plugin release and the newest Obsidian, under some (unknown yet) circumstances, the breaking changes in Obsidian can still prevent the custom-sort plugin from working correctly

Thank you all!

JeNeSuisPasDave commented 4 months ago

Could you please tell me the installer version, in addition to the Obsidian 1.5.8? Sometimes an old installer can cause problems.

Version 1.5.8 (Installer 1.4.13)

JeNeSuisPasDave commented 4 months ago
  • if you create a new vault from scratch, create the simplistic folders/files structure, install only the custom-sort plugin, is the problem still observable?

I created a new vault, and built out the necessary levels of nested folders. After installing the add-in, I could not reproduce the problem.

So, then I opened the problem vault and enabled the plugin, then closed and opened that vault again and now, today, it is working as expected and I don't have any missing folders. Very weird (because it was highly reproducible at the time I posted my original comment).

The only thing that happened (that I'm aware of) between when it was broken (the time I posted my original comment) and when it started working (just before posting this comment) that could possibly influence this is that I logged out of my Macbook yesterday, and then logged back in. I didn't open Obsidian after logging back in, not until just now.

FYI. I have a single sortspec.md document with about 4 different target folder specs. The one that was directed at the folders where I noticed the issue was:

target-folder: Training/Log/*
 > a-z

When the problem was happening, it was only showing two levels of content below the Training/Log subfolder, while I actually have 4 levels of content below that folder.

Also FYI, my vaults are entirely local. No syncing of any kind.

SebastianMC commented 4 months ago

Hi @JeNeSuisPasDave

thanks a lot for checking on your side and coming back with the details! Such a feedback is really helping to keep plugin up-to-date!

Overall, the symptoms which you observed (and what others reported) result from breaking changes introduced by Obsidian. And because of two or three levels of not obvious caching on various levels, even if you update the affected plugin(s), the process of recovering your Obsidian vault instances is multi-step:

  1. Disable the affected plugins (or even better - all community plugins)
  2. Close the affected vault
  3. Restart Obsidian
  4. Open the vault (keeping the community plugins disabled)
  5. Update the plugins (if you didn't it already)
  6. Enable the plugins.
  7. Done.

This guarantees that all internal structures and caches will be purged and loaded anew

The custom-sort plugin intentionally doesn't save any caches to disk. Yet, when it generated the File Explorer data structure in a broken way (due to updated Obsidian and not updated thus incompatible plugin), the broken structure was kept by Obsidian even if you disabled or uninstalled the plugin. I have an impression that this could even outlive the restart of Obsidian. That's why the 1-7 steps were needed to guarantee a correct refresh.

Obviously there is a quicker way - disable the File Explorer (Obsidian core plugin names Files) and re-enable it, which would enforce it to recreate all internal structures. Yet because there are many less advanced user of Obsidian, this could be unclear, vs. the simple app restart scenario.

What you encountered on your side was a mixture of old and new internal states.

I've created the #137 ticket to see if from plugin side the future potential similar scenarios can be made less confusing or avoided.

Thanks!

dustincoates commented 4 months ago

@SebastianMC apologies for the delay in replying; I am on version 2.1.2 and affected me on both Windows and Ubuntu.

2.1.8 does indeed fix the issue.

JeNeSuisPasDave commented 4 months ago

here is a quicker way - disable the File Explorer (Obsidian core plugin) and re-enable it, which would enforce it to recreate all internal structures.

That's a great workaround! I didn't really understand why that could work until I read your explanation about the caches and other data structures that Obsidian maintains. Thanks for that.

BTW, on my computer that core plugin is just called "Files".

SebastianMC commented 4 months ago

Thanks @dustincoates for the update, it allows closing this ticket.

I'm transforming this issue to a discussion of Q&A type - there will be more people facing similar problem and informations presented in this thread can be helpful.

Thanks for all for your input!!!