Open bray opened 1 month ago
Thanks @bray for reporting this with a series of insightful details!
I don't know if it helps but automatic sorting works for me on desktop if File Explorer is visible at Obsidian startup, if another view was open in right sidebar at startup the automatic sorting fails.
On the other side, on iOS even if File explorer is the view in the right sidebar at startup, custom sorting fails to apply automatically.
Hi @Azmoinal
to better understand what happens under Obsidian 1.7.2 I've done a series of tracked executions of various start up sequences of the plugin. Including the Lazy Plugin Loader mentioned by @bray.
BTW the Lazy Plugin Loader plays unfair with delayed plugins and hurts them. It literally removes the delayed plugins from Obsidian's hands and starts these plugins by itself, by disabling and enabling them. This can interfere with internal logic of plugins because the internal handling of 'plugin was enabled' and 'plugin was disabled' are normally edge cases and can involve heavy initialisation or cleanup of internal databases, statuses, data files, etc. Also normally plugins receive some events from Obsidian on start up, which are not delivered when the Lazy Plugin Loaded uses the 'enable plugin' way to start a plugin.
Knowing the above it turns out that handling of the plugin startup sequence under 1.7.2 is a whole different world than when the custom-sort plugin was originally created. A rethinking and rework of the internal start up logic is required to handle as much of the scenarios as possible, including Lazy Plugin Loader.
Yesterday I've created a new branch dedicated for the experiments around correct handling of various start up sequences.
That must be frustrating. Unfortunately, a lot of people are turning to the Lazy Loader because of slow startup times for their plugins. It is a nice option if you use a lot of plugins, but I can see how it's more to handle as plugin developers.
But thanks for your work on getting all this sorted!
I was trying to edit my sorting order today (bookmark drag and drop appears to be bugged in the latest Android version, so I had to resort to JSON editing), and after I have noticed that custom sorting did not apply automatically on startup anymore, which I'm pretty sure wasn't the case just a few hours ago (I would have noticed the orange icon). It would appear that some changes in the configuration enabled the behavior described by OP. My plugins were updated yesterday, as well as application itself. Not terribly helpful, I imagine, still, best of luck in figuring out the solution.
Just adding in my experience in case it shed light on anything. I don't use lazy plugin loader, but do use a decent number of core and community plugins. I use the sortspec file approach.
In iOS it never sorts at startup despite saying custom sort is on. Toggling it off and back on works to apply the sort.
On desktop (windows 11) it's not consistent, sometimes it applies and sometimes it doesn't, but toggling off and on fixes it.
If I'm feeling adventurous I might try utilizing some different methods like bookmarking and index files to see if I can find a method that works. If anyone else has found one, please post 🙏
Install Commander and make a new macro.
On Obsidian startup commander
runs the macro and waits for 2-3s and then it runs the next sort command. This delay ensures that custom-sort
plugin is loaded before the next command gets executed.
Hi @tomoayan,
thanks for posting the instructions on temporary fix using delayed Commander action!
It is equivalent of manual triggering of the custom sort and it will help in the scenarios needing that, for example with Lazy Plugin Loader.
At the same time, let's keep in mind that there are (at least) two major problematic scenarios which require a different treatment:
When launching Obsidian, it no longer automatically sorts when I launch Obsidian. It works when manually sorting via the toggling command.
I was able to get it working on desktop (Mac): I'm using Lazy Plugin Loader, and changing this plugin to load instantly fixes it. That makes it one of the first plugins loaded.
Alternatively, if I disable Lazy Plugin Loader and all plugins except this one, it works on desktop. So, maybe this is related to load order or some other conflict with other plugins?
But neither of those solutions fixes it on Android.
What's interesting to note is in both cases, if I enable notifications, when I launch Obsidian, it shows both "Custom sorting ON" and "Parsing custom sorting specification SUCCEEDED!", but doesn't actually do the sorting.
Not sure if the same or related to https://github.com/SebastianMC/obsidian-custom-sort/issues/162.