Preserve heading/indent foldings on desktop after file is edited on mobile, and vice versa

I live and die by my outliner’s ability to fold headers and lists, and one source of busywork for me is that Obsidian is constantly forgetting my heading/indent folding state on files that I also edit on mobile. Originally I thought this was a bug, but WhiteNoise clarified that I should report it as a feature request instead.

Steps to reproduce this use case / problem:

Given a vault that syncs with the mobile app (Android in my case):

  • Create a TestFile on desktop, whose contents include a simple nested list.
  • Fold the list so the nested contents are hidden.
  • Navigate to another file, then back, to confirm that the fold is remembered.
  • Wait a moment for the changes to sync.
  • Navigate to a different file (on desktop).
  • Open the same file in the mobile app. Note that the list is NOT folded.
  • (in the mobile app) Fold the list. Then edit some other content elsewhere on the page.
  • Wait a moment for the changes to sync.
  • Back on desktop, open the file and notice that your fold settings were reset.

Desired behavior / proposed solution

I’d like my folding state to be preserved even after changes to the file are synced from mobile. Ideally I’d like for folding state to be synced/shared between desktop and mobile, but I suspect this would be technically challenging.

Note that the document folding state is preserved if that page stays open in the desktop app when the changes are synced from mobile. Folding is only lost if the file is not currently being displayed in the desktop app.

Also note that the problematic behavior runs both ways: editing the file on desktop causes my mobile app folding state to get lost, which is comparably inconvenient.

Current workaround

My only workaround right now is to just avoid editing certain files on mobile, because I know that doing so will bulldoze the file’s folding state on desktop (assuming the file is not currently open at the moment of sync) and then I’ll need to manually re-fold again to hide the clutter. The “Fold all headings & lists” command isn’t much use here because usually I don’t want to fold all top-level headings, only certain cluttered sections.

19 Likes

Why wouldn’t this be possible? Folding state should be a “first-class citizen” of Obsidian. In terms of UX, the fact that folding state isn’t preserved across devices is annoying.

So +1 :-).

3 Likes

I was also surprised to see the folding state isn’t synced. +1 as well.

1 Like

Another workaround would be to use the ‘Creases’ plugin. You can set it to open notes with the ‘creased’ parts folded by default.

And I agree, I use very long notes with unimportant text parts folded out of sight, and it often takes me a long time to find the relevant sections again because everything gets unfolded when I edit the note on different devices.

2 Likes

Creases doesn’t work for folding headings if you’re using the Daily Note plugin. Would love to see folding work with sync.

I’m looking foward to this feature. Hope can implement it ASAP!

What would make this so hard? As I mentioned in my thread, the makers of Obsidian have already done this in Dynalist.

My other question: How hard would it be to make a plugin to do this? Should we put in a request in the Plugins section of these forums?

Instead of doing some things in Dynalist and others in Obsidian, I’d really like to go all-in on Obsidian… But this isn’t practical for me until folding status is preserved.

I just discovered this. Haven’t tried it yet

obsidian://show-plugin?id=obsidian-remember-file-state

This seems like a strange limitation that would be fairly easy to fix. Currently, foldings are saved using localStorage, which means they only exist per individual installation. They are simply entries stored for every file that has foldings, saying “fold from this line to this line”. This could very easily be stored in a JSON file in the vault and then would sync everywhere. I’m not sure why they chose to do it this way. Maybe performance?