I have seen in a number of scenarios it would be useful for a plugin to know if a sync is in process, so that it can wait to perform any actions until the sync is done. I don’t have a recommendation for an implementation, but probably something like registering to observe a start and complete sync events, along with perhaps a vault function for checking sync state (ex: app.vault.isSyncing(): boolean).
Additionally, as a sync user, I would like to have an option in settings to toggle on delayed loading of plugins until sync has finished. That way the newest data and any other plugins installed/updated on other devices have synced over. So if this “delayed plugin loading” was enabled:
- Obsidian starts
- Sync starts and finishes
- Then all enable plugins are loaded
Thanks for considering this request.
14 Likes
+1 absolutely yes for delayed loading of plugins after sync
Sync wreaks havoc with plugins so I rarely use Obsidian Sync and usually avoid using Obsidian on iPadOS.
So if this “delayed plugin loading” was enabled:
- Obsidian starts
- Sync starts and finishes
- Then all enable plugins are loaded
Thanks for considering this request.
I would add that this is a dynamic problem. I often create a file and then the templater script executes on both machines.
It would be nice to have a 1 minute (or configurable) delay on new file creation to avoid this problem.
3 Likes
Hi, I think this has been resolved. You can check the sync status via,
let sync = this.app.internalPlugins.plugins.sync.instance;
sync.on("status-change", () => { console.log("sync status is", sync.syncStatus) })
per Discord
I implemented this in one of my plugins to only run a task that depends on the state of the filesystem after syncing is finished
1 Like