vrtmrz / obsidian-livesync

MIT License
3.92k stars 132 forks source link

Ask for "Reload Obsidian" when it is safe to do #413

Open alx-xlx opened 2 months ago

alx-xlx commented 2 months ago

Whenever I Customization Sync the device the "Reload Obsidian" options shows randomly when important sync is happening, And and when pressing the reload button it just corrupts the sync and it fails.

It is not an issue on Desktop but on Mobile the "Reload Obsidian" dialogue box just (covers) takes the entire screen such that the updates are not even visible. And it hides the sync indicators

I think it would be a better thing if it asks for Reload when all important sync is over and its safe to reload. OR maybe it takes the input now but then reloads when it all the important sync has completed.

vrtmrz commented 1 month ago

I appreciate your proposals! Indeed reloading while busy states may be potentially harmful. And, a while ago, we could not detect the busyness, but now it can be with a bit more certainty.

This might be a good opportunity. I will try to implement this!

vrtmrz commented 1 month ago

It has been implemented at v0.23.7. Would you mind if I ask you to check the behaviour, please?

alx-xlx commented 1 month ago

Yes, it works well. Now we don't have to wait and constantly stare at the indicators to restart obsidian. :p

alx-xlx commented 1 month ago

Just curious if the busyness status of livesync can be accessed by other plugins ?

vrtmrz commented 1 month ago

Sorry for being late! Actually, I also wanted the feature for interop between the plugins but nothing there now. For now, we are only able to access Self-hosted LiveSync by accessing app.plugins.plugins["obsidian-livesync"] and its props.

If you have specific scenarios in mind, I am happy to explore ways to make communication a bit safer. For instance, I could register custom event handlers in the window to respond to specific requests.