Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken template after updating Templater to v1.18.0 (still working fine with Templater 1.17.0)... #1245

Closed
I-Pch opened this issue Nov 16, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@I-Pch
Copy link

I-Pch commented Nov 16, 2023

Hi there 😊 !
I don't know if opening an issue regarding this strange behaviour was necessary but just in case, here I am 😇 ...

So, the problem is that I updated Templater from v.1.17.0 to v.1.18.0 and out of the blue, for no apparent reasons, one of my template manipulating the frontmatters of a note simply didn't work anymore with Templater 1.18.0 while still working as expected with Templater 1.17.0.
(I didn't made any other changes in my vault: just updating Templater to the last version 🤷‍♀️ )

Plugin information (please complete the following information):

  • OS: MacOS Big Sur 11.7.10
  • Templater version: 1.18.0
  • Obsidian version: 1.4.16
  • Templater settings:

Currently broken template when using Templater 1.18.0:

<%*
const file = tp.file.find_tfile(tp.file.path(true));
await app.fileManager.processFrontMatter(file, (frontmatter) => {
  frontmatter["status"] = "In progress";
  frontmatter["review count"] += 1;
})
-%>

Describe the bug:

When applying the template, I can see that the template works as it is but the output doesn't seem to be written on file anymore 🤨 .
I mean, the output doesn't stick/is not saved in the note and is automatically reverted...


Expected behavior:

Well, I would like to have the output actually written on file 😅 ... As it still is when using Templater 1.17.0 😊 .


Screen-recordings:

As images will probably be more telling than anything else, here are the tests I ran with the problematic "broken" template.

🔴 Test 1: Sandbox vault + Templater 1.18.0 + Empty note:

Sandbox.vault.+.Templater.1.18.0.+.Empty.note.mov

🔴 Test 2: Sandbox vault + Templater 1.18.0 + 1 key in Properties:

Sandbox.vault.+.Templater.1.18.0.+.1.key.mov

🔴 Test 3: Sandbox vault + Templater 1.18.0 + the keys in Properties the template should manipulate:

Sandbox.vault.+.Templater.1.18.0.+.the.keys.the.template.should.manipulate.mov

🟢 Test 4: One of my vaults + Templater 1.17.0 + Empty note:

One.of.my.vaults.+.Templater.1.17.0.+.Empty.note.mov

🟢 Test 5: One of my vaults + Templater 1.17.0 + 1 key in Properties:

One.of.my.vaults.+.Templater.1.17.0.+.1.key.mov

🟢 Test 6: One of my vaults + Templater 1.17.0 + the keys in Properties the template should manipulate:

One.of.my.vaults.+.Templater.1.17.0.+.the.keys.the.template.should.manipulate.mov

Additional context:

I first saw this in one of my messy "Test" vaults where the only thing that I changed that day was updating Templater 🤷‍♀️ .

Both vaults used to test the behavior of the template are completely different but I can definitively say for sure that the template (and its variations) used to work as expected using previous version of Templater.

Which leads me to think that maybe, the introduction of tp.hooks has some unexpected side effects ? 🤷‍♀️
Even if it's not used or called anywhere ? 🤔

Should I now update the template and use tp.hooks ?
Should I now always rely on tp.hooks when it comes to modify some frontmatters ?

I'm sorry 😅 ... I'm no dev' so this is a bit confusing for me 😇 ...
But in any cases, thank you very much in advance for potentially taking a look/providing some guidance 🙌 !

@I-Pch I-Pch added the bug Something isn't working label Nov 16, 2023
Zachatoo added a commit that referenced this issue Nov 17, 2023
@Zachatoo
Copy link
Collaborator

Should be fixed in 1.18.1, thanks for writing this up! Please let me know if this issue persists after updating!

@Zachatoo
Copy link
Collaborator

Side note: this is probably the most thorough bug report I've ever seen, and I've seen thousands if not tens of thousands of bug reports. You are awesome.

@I-Pch
Copy link
Author

I-Pch commented Nov 17, 2023

Just run a quick test in the Sandbox vault after updating Templater (1.18.0 > 1.18.1) and the problematic template seems to be working as expected again 🥳 🙌 !
(I.e.: The frontmatters are written on file and staying there 😁 🎉 !!!)

Sandbox.vault.+.Templater.1.18.1.mov

Thank you so very much for the quick fix @Zachatoo 🙌 🎉 !!!

P.S.:

Side note: this is probably the most thorough bug report I've ever seen, and I've seen thousands if not tens of thousands of bug reports. You are awesome.

No problem 😉 ! I just do the best I can, trying to help 😊 💖 ...

@I-Pch I-Pch closed this as completed Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants