Replies: 1 comment
-
I'm afraid this does sound like a race condition, but I'm sorry to tell you that I think this is more of a plugin incompatibility than a bug. I'm unfortunately not aware of any functionality in Obsidian's API that might allow either this plugin or Templater to "lock" a file to prevent other plugins from attempting to make simultaneous writes. For further context: these are the lines responsible for the entirety of reading the file data in, applying your patch, and writing out the output: obsidian-local-rest-api/src/requestHandler.ts Lines 437 to 451 in ecea4e7 PATCH changes.
Since this is probably a problem unique to your particular use of Templater with daily, automatically-created notes, I'm afraid all I can suggest off-hand is that you maybe find some way of ensuring that Templater runs before the That all being said, there are possibly forward-looking technical solutions to this, but I'm afraid none of them would start here:
I know this isn't the answer you're hoping for, but I'm not sure there's any immediately-obvious solution that involves changes to this library, so I'm going to convert this issue to a discussion. Definitely feel free to let me know, though, if you can think of some options I haven't considered, though 🤷 . Footnotes
|
Beta Was this translation helpful? Give feedback.
-
When doing a
PATCH
on my daily note to append content after a heading, if the note does not exist the content that should be appended gets overwritten on templater execution.I'm not really sure if the bug exists here, or within the Templater plugin tbh. But here's what I'm seeing when I set a breakpoint and step through the code.
PATCH
)2024-10-03
as expected.PATCH
append request is added to the unparsed template file.PATCH
ed content and leaving you with an empty templated daily note file.I saw
PATCH
originally had issues with creating the periodic note and the solution was to wait for the metadatacache to have the file to ensure it's been created. Should this possibly also wait until templating of the file has completed?Do you think this is more of a bug with Templater? Seems sort of like a race condition between the two plugins, but it's hard to tell.
Beta Was this translation helpful? Give feedback.
All reactions