akosbalasko / zoottelkeeper-obsidian-plugin

Obsidian plugin of Zoottelkeeper: An automated folder-level index file generator and maintainer.
183 stars 11 forks source link

Deleting a folder in Obsidian does not regenerate the index in the parent directory #44

Closed claremacrae closed 2 years ago

claremacrae commented 2 years ago

I'm trying to workaround all the dangling links from cases I described in #41...

More realistic repro

Given this:

Parent Folder/Child Folder/[various .html files]

I was getting a dangling link in Parent Folder's index, saying Child Folder didn't have an Index.

I decided I didn't care about the old html files, so in Obsidian's navigator, I right0clicked on the 'Child Folder' and deleted it.

The index in Parent Folder was not regenerated.

Original Report

I had this, where _scripts was an empty folder:

image

So there was no index in _scripts.

Outside of Obsidian, I deleted the _scripts folder.

I expected that this plugin would regenerate the index and fix the link.

It didn't, and I had to trigger regelation manually.

Is this expected?

akosbalasko commented 2 years ago

Hi @claremacrae , Yes, it is expected, if you delete a folder outside of Obsidian, there is no trigger that should push the reindexing. And because of performance considerations the reindexing is done on a folder (and it's parent) where an action (file creation/rename/deletion) was taken.

claremacrae commented 2 years ago

Hi @akosbalasko

... And because of performance considerations the reindexing is done on a folder (and it's parent) where an action (file creation/rename/deletion) was taken.

Ok that explains a lot of the usability/inaccuracy problems I'm seeing with it.

Unless it also reindexes when folder creation/rename/deletion is done, it will forever be tripping users up.

Folder creation is less important, so long as it then detects a new file inside the as-yet-un-indexed-new-folder...

But not detecting folder rename and folder deletion will always leave users with broken indexes.

Another problem with not detecting folder renames is all the duplicate indexes users see after renaming a folder - where they then have to manually delete the index with the old name.

If it really, really is not possible to track folder changes, then here are some alternative suggestions...

Sticking Plaster 1

Make it so that the default behaviour is to track folder renames and deletions - but put in a setting to turn that behaviour off, if users complain about the impact.

That way, novice users get the correct behaviour, without needing manual intervention - and those with massive vaults, who are also more likely to be familiar with setting plugin settings, can customise it if they wish.

Sticking Plaster 2

At least make it possible to regenerate the indices via Command/Ctrl P for the Command Palette, and hence also by a keyboard shortcut - because keeping on going back to the preferences dozens of times to regenerate is getting old!

Many users won't know about the manual regenerate step, though - so it's much better trying to avoid users needing to:

  1. discover they have a broken index and
  2. knowing how to fix it