javalent / obsidian-leaflet

Adds interactive maps to Obsidian.md using Leaflet.js
481 stars 29 forks source link

[Regression] `markerFolder` no longer automatically includes subfolders since 5.3.0 #366

Closed Sirs0ri closed 1 year ago

Sirs0ri commented 1 year ago

Update: there's a workaround, see this comment below!

Description of the problem

The update to 5.3.0 broke the ability to create markers from all notes inside a folder, including subfolders. The documentation mentions it should "search through all of the notes in the specified folder, even in sub folders", which was the case before the update. However since 5.3.0, only the specified folder is checked, and subfolders are ignored.

Steps to reproduce

  1. Make sure Obsidian Leaflet >= 5.3.0 is installed, no other plugins (eg DataView) should be needed.
  2. Create a folder "Testfolder" inside the root of a vault, and inside that another folder called "Subfolder"
  3. Create the note called "Test" with the content listed below inside the "Testfolder" folder
  4. Move the cursor out of the leaflet codeblock to let it render, you should now see a marker for the "Test" note
  5. Move the note into the "Subfolder" folder
  6. Move the cursor into, then out of the leaflet codeblock to let it refresh, you should no longer see a marker for the "Test" note

Expected / observed behavior

General Info

Obsidian version: v1.1.16 Last working version of this plugin: 5.2.6 Content of the "Test.md" note, mentioned in step 2 above:

---
location: [0, 0]
---

```leaflet
id: test
lat: "0"
long: "0"
markerFolder: "Testfolder"
```
sigrunixia commented 1 year ago

@Sirs0ri Can you update to the latest version and confirm if you are still having issues? In the meantime, I have marked this as a critical bug.

Sirs0ri commented 1 year ago

Yes, this still happens in the latest version: obsidian v1.1.16, installer 1.1.9, obsidian-leaflet 5.5.3

Here's a test vault with examples (in Testfolder/): obsidian-test.zip

(The vault also includes an example for the problem reported in #361)

sigrunixia commented 1 year ago

Thanks for the response and vault inclusion for both issues. :) We'll see what we can do.

Sirs0ri commented 1 year ago

A look at the code shows me that this was introduced with #350, which in fact introduced a limit to how deep Obsidian scans that hasn't been documented.

As a workaround, more slashes can be added to the markerFolder parameter (eg, markerFolder: "Testfolder/////" for a scan-depth of 5 subfolders deep), but I'd appreciate a more user friendly solution, and I'm hoping we can find one out in the discussion for the PR that introduced the change!

In the meantime, I don't think this has to be marked as "critical" anymore, since there's a workaround! :)

sigrunixia commented 1 year ago

@valentine195 I know you are out of town this weekend, but what do you think about depth of relevant paths as part of documentation examples?

valentine195 commented 1 year ago

I commented this on #350 but I didn’t think this PR through fully before merging. I will probably end up reverting the depth, or making it optional.