update-time-on-edit-obsidian icon indicating copy to clipboard operation
update-time-on-edit-obsidian copied to clipboard

Lots of "note" has been modified externally, merging changes automatically when update-time-on-edit enabled.

Open chigh opened this issue 1 year ago • 7 comments

I don't know if this is something that's happening with the insider version of Obsidian (1.4.2) or the update-time-on-edit plugin (version 2.0.2), but I've been getting lots of the following messages.

"Note title" has been modified externally, merging changes automatically.
Screen Shot 2023-08-03 at 18 19 25

Sometimes the messages come one right after another. Sometimes, it will start immediately upon typing in a note, and other times, it doesn't for a brief period of time. I noticed the plugin no longer has the setting in the Obsidian interface to change the time between updating and is updating almost immediately after and during typing in a note. There is a setting in the data.json file, and it's set to one minute, but the plugin doesn't wait one minute to update the notes.

  "minMinutesBetweenSaves": 1,

When I disable the plugin, these messages stop. I have a number of other plugins enabled. I could disable them all and try again, but none of them update notes like this one does, and I really like/want what this one does.

https://github.com/beaussan/update-time-on-edit-obsidian/assets/4204038/a24077ce-f3dc-499e-b684-d36a460f2719

chigh avatar Aug 03 '23 22:08 chigh

I am on Obsidian 1.37 and noticed a similar issue with 2.02. I never had a issue previously with Update Time on Edit. I noticed the issue when some files that I was editing would suddenly erase keypresses that I just had made a few seconds earlier. I noticed a lot of sync activity going on with the last few tiles I edited. I also noticed that the time kept incrementing every 10 seconds in front matter and it would of course sync that change. The file just kept going around and around. I use Obsidian Sync and was testing with 3 computers in front of me.

I disabled the plug-in and the syncing resolved itself. Hope this helps.

opensolutionsgroup avatar Aug 04 '23 18:08 opensolutionsgroup

Hi, first of all, thanks for raising this issue !

I noticed the plugin no longer has the setting in the Obsidian interface to change the time between updating and is updating almost immediately after and during typing in a note. There is a setting in the data.json file, and it's set to one minute, but the plugin doesn't wait one minute to update the notes.

Yes, I removed this option with the new v2 approach, but I am going to rollback this, while changing the way it behaved. This should also temorrary fix the issue about the sync

I also noticed that the time kept incrementing every 10 seconds in front matter and it would of course sync that change. The file just kept going around and around. I use Obsidian Sync and was testing with 3 computers in front of me.

This is a limitation currently of Obsidian api that should be fixed soon (according to this github issue) ! TLDR: this plugin relies on mtime (modification time) from filesystem & obsidian, however, the current api don't allow to update such time to the previous one while editing the frontmatter, and thus, causing a sync with a new ctime; causing the second computer to update the header again, etc.

beaussan avatar Aug 06 '23 16:08 beaussan

Thanks for the response!

chigh avatar Aug 06 '23 17:08 chigh

v2.1.0 added back the minMinutesBetweenSaves setting in a new way, this should address the sync issue.

In the meanwhile we have the proper api from Obsidian to ensure mtime is not modified, you can increase the delay between updates ! :tada:

Here is the TLDR of how it works :

graph TD
I{File changed} --> A
A{"Update header already present?"} -->|No| U{Update header with mtime}
A --> |Yes| C{Read update value. Is it enough passed since last update ?}
C --> |Yes| U
C --> |No| E{Do nothing}
U

beaussan avatar Aug 06 '23 21:08 beaussan

Thank you!

chigh avatar Aug 07 '23 13:08 chigh

This should be way better with the newer version, https://github.com/beaussan/update-time-on-edit-obsidian/releases/tag/2.3.0 ! This plugin no longer edit the file's creation & modification time

beaussan avatar Sep 06 '23 21:09 beaussan

Two things were done to improve this futher :

  • this plugin will now not longer edit file ctime & mtime, thanks to a new Obsidian api
  • using this experimental flag, you can now ensure the header is not updated, even if the time was, when the file was not modified (like with a thrid party sync) https://github.com/beaussan/update-time-on-edit-obsidian/releases/tag/2.4.0

beaussan avatar Sep 28 '23 20:09 beaussan