beaussan / update-time-on-edit-obsidian

MIT License
165 stars 15 forks source link

Potential bug in the plugin in Obsidian v. 1.5.5 #70

Closed TomBirkland closed 7 months ago

TomBirkland commented 7 months ago

Under the editor v 1.5.5, this plugin appears to misbehave. Instead of including the file date and file modified date in the YAML front matter, the plugin appears to insert these dates in a loop that recurrs about thirty times, yielding results like this.

created: 2024-02-13T22:25 updated: 2024-02-13T22:25 created: 2024-02-13T22:25 updated: 2024-02-13T22:25 created: 2024-02-13T22:25 updated: 2024-02-13T22:25

Disabling the plugin stops the error, but removes its functionality. Reinstalling the plugin replicates the error. It seems that the plugin isn't forming YAML correctly. Sorry if this is insufficiently detailed--I am not a programmer, but am an end user.

mickahouan commented 7 months ago

Same bug for me

elvarb commented 7 months ago

This seems to happen only if there is no frontmatter defined in the file.

TomBirkland commented 7 months ago

This seems to happen only if there is no frontmatter defined in the file.

This is exactly what I found. So a workaround would be to make sure that there's some frontmatter defined. I think I might be able to use the Templater plugin to fix this. But this wasn't required before this bug arose, so it would be good to see a solution.

mikemp7 commented 7 months ago

+1. Workaround works. But aggro bug ...

spiritualgeek commented 7 months ago

Under the editor v 1.5.5, this plugin appears to misbehave. Instead of including the file date and file modified date in the YAML front matter, the plugin appears to insert these dates in a loop that recurrs about thirty times, yielding results like this.

created: 2024-02-13T22:25 updated: 2024-02-13T22:25 created: 2024-02-13T22:25 updated: 2024-02-13T22:25 created: 2024-02-13T22:25 updated: 2024-02-13T22:25

Disabling the plugin stops the error, but removes its functionality. Reinstalling the plugin replicates the error. It seems that the plugin isn't forming YAML correctly. Sorry if this is insufficiently detailed--I am not a programmer, but am an end user.

Exactly the same for me and I can't live without this plugin :(

gapmiss commented 7 months ago

If this is the cause of the issues, it will be fixed in next update.

https://forum.obsidian.md/t/automatically-update-last-modified-date-in-note/51776/64

beaussan commented 7 months ago

Hey everyone, turns out it was an obsidian bug!

I was trying many thing to circle around it to ensure this was not happening, trying double updates, going back to editing manually the front matter, but since they are fixing it in next update, this should be good!

For you information, now this plugin relies heavily on app.fileManager.processFrontMatter from obsidian directly so that I have the same read and write system that obsidian itself uses to ensure the implementation doesn't drift from the official one.

Keeping this thread open until they fixed it, in the meantime, I suggest to go back to a stable obsidian version where this bug is not present

TomBirkland commented 7 months ago

Hey everyone, turns out it was an obsidian bug!

I thought this might be the case. I don't rely on this as heavily as other folks, so I am using Linter as a stopgap now but will reinstall this plugin (it's incredibly useful) when Obsidian updates the editor. Thanks for the quick followup.

gapmiss commented 7 months ago

This is now fixed in beta v1.5.6 (Insider's release)

TomBirkland commented 7 months ago

This is now fixed in beta v1.5.6 (Insider's release)

Thanks for letting us know! I confirmed that it works as before.

FeralFlora commented 7 months ago

The fix should be public now, so this can be closed?