Skip to content

Conversation

@Zweikeks
Copy link

The new class SyncMonitorObs is added. It monitors sync activity.
The new functionality can be enabled in the settings. It is marked as experimental in the settings.
If enabled saveData() is blocked until sync has finished. This prevents overwriting changes coming in from the remote vault.

kh4f added a commit that referenced this pull request Oct 31, 2025
…ng non-manual/synced changes

- Track manual changes in `afterCreate` and `trashFile` patches
- Add `manuallyChangedItems` Set to track files created/deleted manually on current device
- Skip settings save when item wasn't changed manually (likely synced from another device) to prevent merge conflicts in `data.json`

Refs #73, #80
@kh4f
Copy link
Owner

kh4f commented Oct 31, 2025

Hi @Zweikeks, thanks a lot for the proposed solution! Unfortunately, it relies heavily on Obsidian Sync, and I can’t even purchase a subscription to test it (the issue isn’t about money) ...

Since we’re trying to find a softer workaround, I’d suggest a simpler approach:

  • Skip saving settings to data.json when updateOrder() is triggered by workspace layout ready (since it’s not really necessary anyway, and during sync it only causes trouble).
  • Track whether a file was created/deleted on the current device; if not - skip saving data.json in updateOrder().

This way, data.json only gets updated when files are modified locally through Obsidian's interface (via afterCreate and trashFile calls) or during drag & drop.

I’ve implemented this in the fix/sync-conflict branch. Please give it a try with Obsidian Sync when you have some free time, since I’m not sure whether it handles renaming/moving a file on device 1 as a delete+create event on device 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants