Custom sort does not work on mobile
I have Obsidian Sync enabled and noticed the following behaviour:
- on windows PC, the sorting happens on a load, with default settings, the delay being 1 sec
- on mobile, I get an error: the plugin fails to sort and advises to check the developer console, which I can't check on android
I tried setting the delay to 2-3 sec, no change. When I increase the time to 5-10 sec to be safe, the sorting command does not even run, no error, nothing.
Pressing the run custom sort option in the menu or the command palette works after the initial error message, so my syntax is correct.
Am I missing something?
Hi @bodydisplaynone,
thanks for catching this scenario and reporting it! I assume you are facing one of 'dark sides' of internal changes of Obsidian, introduced in Obsidian 1.7.2 Namely, the 'deferred views' idea, performance optimization. It means that some views, including File Explorer, are not created and initialised automatically on app start, especially on mobile. They are created and rendered on demand, when you display it for the first time. In result the custom sort plugin cannot apply it sorting automatically on start, there is no File Explorer to apply the sorting to. Unfortunately, Obsidian doesn't expose a mechanism to notify the plugin(s) when a given view (e.g. File Explorer) is created and rendered to give them a chance to do their work, like applying the sort order. Maybe this will be fixed in some of future Obsidian releases, I will be happy to update my plugin then.
Unfortunately, there is no cure for that scenario except for applying the custom sorting manually, when the File Explorer is displayed.
In result of your report I prepared a new version of the plugin, 3.1.2 and released it a minute ago. Please download and observe the behaviour. If you are facing the above scenario indeed, you should see now a more informational message:
Custom sort File Explorer view problem - is it visible? Can't apply custom sorting when the File Explorer was not displayed at least once.
It is all I can do for now.
BTW technically the plugin can enforce creation and population of File Explorer view. At the same time this would go against the optimisation idea introduced by Obsidian team, File Explorer being one of the heaviest views. That's the reason not to go that way.
Ok, please test with the newest release of the plugin and let me know. If you are encountering a different problem, I will ask more questions to be able to troubleshoot
I was having this issue and came here to report, saw this, updated to 3.1.2, force closed app, reopened, and it was sorted
¯\(ツ)/¯
Closing - the issue has been addressed. Coming release of the plugin will also improve automatic application of custom sorting on startup to cover all remaining scenarios.