Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom sort does not work on mobile #193

Open
bodydisplaynone opened this issue Jan 22, 2025 · 2 comments
Open

Custom sort does not work on mobile #193

bodydisplaynone opened this issue Jan 22, 2025 · 2 comments
Assignees

Comments

@bodydisplaynone
Copy link

bodydisplaynone commented Jan 22, 2025

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?

@SebastianMC
Copy link
Owner

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

@SebastianMC SebastianMC self-assigned this Jan 23, 2025
@tdtrumble
Copy link

tdtrumble commented Jan 25, 2025

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
¯\(ツ)

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

No branches or pull requests

3 participants