nathonius / obsidian-collapse-all

MIT License
92 stars 2 forks source link

plugin stopped working completely #43

Open wealthychef1 opened 7 months ago

wealthychef1 commented 7 months ago

Even in the sandbox vault, if I install and enable Collapse All, the commands do not collapse anything any more... latest version of Obsidian Version 1.5.11 (Installer 1.4.13) on MacOS. here is a movie of what happens in my Sandbox vault.

2024-03-19 16 11 06 CleanShot Obsidian

nathonius commented 7 months ago

Ah, there must have been a breaking change in Obsidian. I'll see if it's an easy migration.

wealthychef1 commented 7 months ago

Thanks for looking into it. I use your plugin all the time. :-).

andrewheekin commented 7 months ago

Thanks @nathonius ! also a big fan of the plugin and missing it :)

For what it's worth, the latest Obsidian version v1.5.11 and obsidian-collapse-all v1.5.3 seem to be compatible

nathonius commented 7 months ago

@wealthychef1, @andrewheekin should be resolved now! There were some internal changes to Obsidian's API, and I updated the providers for all features. Just update to v2.1.0 of the plugin. 👍

andrewheekin commented 7 months ago

@nathonius thanks for the update, but unfortunately the new version doesn't seem to be working for me. Happy to give more details if desired! Obsidian v1.5.11 and obsidian-collapse-all v2.1.0

wealthychef1 commented 7 months ago

@wealthychef1, @andrewheekin should be resolved now! There were some internal changes to Obsidian's API, and I updated the providers for all features. Just update to v2.1.0 of the plugin. 👍

Works for me, thanks 2024-03-31 update: stopped working!

benlind commented 7 months ago

@nathonius , I am also seeing this broken with Obsidian v1.5.12 and obsidian-collapse-all v2.1.0. Do you want me to create a new issue, or do you want to reopen this one?

nathonius commented 7 months ago

I'll take a look, hopefully I just did something dumb with the release and it's not more breaking changes. It's also possible it's because I did this on an insiders version of obsidian.

Nikolai2038 commented 7 months ago

Can confirm, the collapse is not working for me too (but toggle action works - so I use toggle twice for now as workaround)

Windows 11, Obsidian v1.5.12, Collapse All v2.1.0

nathonius commented 7 months ago

I've been able to confirm that this is actually just a bug in Obsidian 😂

What is happening is that internally Obsidian's collapsed / expanded state is not updating consistently when opening / closing folders. So because Obsidian thinks the tree is already collapsed, it won't do it again. This is reproducible using the built-in collapse / expand button in the file explorer, for example.

I'm going to report this bug and see if I can come up with a workaround in the meantime. Binding the toggle command (and possibly hitting it twice) will probably serve you better until this is fixed.

EDIT: Looks like there's already a report: https://forum.obsidian.md/t/collapse-all-button-act-like-expand-all-when-folders-are-unfolded-manually/78568

andrewheekin commented 6 months ago

@nathonius might be part of the bug, but do you know whether there is an obsidian command to collapse all folders in the file explorer? Similar to how there is a "file-explorer:reveal-active-file" command to reveal the active file.

andrewheekin commented 6 months ago

Or out of curiosity, how does the Obsidian native "Collapse all" button work

nathonius commented 6 months ago

@nathonius might be part of the bug, but do you know whether there is an obsidian command to collapse all folders in the file explorer? Similar to how there is a "file-explorer:reveal-active-file" command to reveal the active file.

Not built in, that's what this plugin provides. However it's currently kind of broken due to the bug mentioned above.

nathonius commented 6 months ago

Or out of curiosity, how does the Obsidian native "Collapse all" button work

Internally it varies from view to view, but the file explorer and a few others use a tree data structure that has collapse / expand functionality. This plugin just hooks into it and exposes it as a command. The native collapse expand button is just calling those same functions on the tree. You can see the function calls here:

https://github.com/nathonius/obsidian-collapse-all/blob/main/src%2Fprovider%2Fbase.ts#L100