[BUG] Templater code does not execute
Describe the bug On version 1.13.3, Templater code in the template does not execute if the "Create file if it doesn't exist" function is used.
To Reproduce
Expected behavior The code of the template will be executed at the capture.
Screenshots
The text is added, but the Templater code from the template does not execute.
Desktop (please complete the following information):
- OS: Windows
- Version 26100.4061
I can also reproduce this bug on Android. Version 1.13.2 does correctly replaces templater scripts upon quick add capture while version 1.13.3 does not.
I'm in the same situation.
Same here. This is likely due to 76a8438ce8f9303b203b55a2809365a59855067f. After thorough testing, the issue only appears when {{value}} is used. For example:
This capture format will replace all templater syntax:
- a
But this won't:
- a {{value}}
If QuickAdd is able to instantly write its contents the issue doesn't appear. However, when a delay is added, such as the case as we are waiting for the user to enter the text and press OK in the popup of {{value}}, templater scripts won't be replaced in the note.
Furthermore, running
- {{value}}
- <% tp.date.now("YYYY-MM-DD", 0) %>
results in <% tp.date.now("YYYY-MM-DD", 0) %> being resolved by Templater, but none of the other Templater code in the note (template) gets resolved.
The culprit: https://github.com/chhoumann/quickadd/commit/76a8438ce8f9303b203b55a2809365a59855067f#diff-feedb8108cbffaba02c601ef7e3f8d09bf6f601c6188d5c4e192a04d5632540cL98-L108
Hi @BugCatcher91, @ziwensite, and @SublimePeace,
Thank you all for reporting this issue and providing detailed analysis! @SublimePeace, your investigation pointing to the specific commit and identifying that the issue occurs with {{value}} variables was incredibly helpful.
I'm happy to report that this issue has been comprehensively fixed in QuickAdd v1.16.0. The fix (PR #835) completely reworked how QuickAdd integrates with Templater when using "Create file if it doesn't exist."
The root cause was exactly as @SublimePeace identified - when QuickAdd waited for user input (like {{value}}), Templater would run too early, before the async content was resolved.
Could you please update to v1.16.0 and confirm that your templates now work as expected? All Templater code should execute properly, regardless of whether you use {{value}} variables or not.
Thank you again for your patience and detailed debugging - it made fixing this issue much easier!