mProjectsCode / obsidian-meta-bind-plugin

A plugin for Obsidian to make your notes interactive with inline input fields, metadata displays, and buttons.
https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/
GNU General Public License v3.0
390 stars 33 forks source link

MB gets stuck in a `load settings`/`save settings` if a vault where it's installed is opened on 2 devices (Desktop + Mobile) at the same time #311

Closed I-Pch closed 2 months ago

I-Pch commented 2 months ago

Please fill out these Check-boxes

This Issue Occurs on

Plugin Version

1.1.0

Describe the Issue

Hi there 😊 !

Wanting to see how a Meta Bind/JS Engine setup I'm working on looked like on mobile, I simply launched Obsidian Mobile for a quick peek 😊 ... On Desktop, I had the Dev Tool opened and after checking if everything seemed to work as expected on mobile, I glanced at my Mac to discover that, for some reasons, Meta Bind was loading and then saving its settings every few seconds or so 🤔 ...

It was one of the first time I opened that specific vault on mobile (all my vaults are stored on & synced through iCloud) while also having the same vault opened on desktop...

I thought that maybe it was just an "iCloud" thing 😄 ...

So, just to be sure, I opened Finder on my Mac, opened the hidden .obsidian folder of the vault and saw that Meta Bind's data.json was apparently uploaded every few seconds...

The loop only stops when I close Obsidian on mobile (iPad).

While this happens, the console only reports:

...
meta-bind | Main >> settings load           plugin:obsidian-meta-bind-plugin:135 
meta-bind | Main >> settings save           plugin:obsidian-meta-bind-plugin:135
meta-bind | Main >> settings load           plugin:obsidian-meta-bind-plugin:135 
meta-bind | Main >> settings save           plugin:obsidian-meta-bind-plugin:135
meta-bind | Main >> settings load           plugin:obsidian-meta-bind-plugin:135 
meta-bind | Main >> settings save           plugin:obsidian-meta-bind-plugin:135
...

And here's a screen-recording of what I could see in the Finder and what the console was saying 😊 ...

https://github.com/mProjectsCode/obsidian-meta-bind-plugin/assets/77828085/32f095e5-2573-4873-9353-9be81febc6da

Steps to Reproduce

I am not entirely sure what precisely triggers the start of the loop 🤔...

But from what I've seen, having a vault where Meta Bind is installed and enabled opened on both desktop & mobile at the same time seems to be enough to initiate the loop.

I've tested this multiple times and I didn't really need to interact with the note opened on launch on Mobile for the loop to begin ...

The note I used for test purposes contains only this:

---
done: false
---

`INPUT[toggle:done]`

If I launch Obsidian mobile on an empty new tab (so, with no note opened at launch), the loop starts as soon as I interact with Obsidian in a way or another (closing the Debug startup time notice, opening the quick switcher to open a note, etc...).

So I'm not sure the content of a potentially opened note on launch, on mobile, does really matter 🤷‍♀️ ...

Expected Behavior

I guess that it would be nice, if possible 😊, if Meta Bind did to not try to save and sync its settings/data.json every few seconds while having the same vault opened on both desktop and mobile 😇 .

Thank you very much in advance 🙌