shabegom / buttons

Buttons in Obsidian
The Unlicense
478 stars 50 forks source link

Templater button loses template in button block after first use #38

Closed DanF-88 closed 3 years ago

DanF-88 commented 3 years ago

If I have a button block like

name Create New Meeting File
type note(Team meeting <% tp.date.now("YYYY-MM-DD") %>) template
action Meeting template file
templater true

^button-myteammeeting

If I press the button, the file ('Team meeting 2021-05-14') is successfully created, but the button block now reads:

name Create New Meeting File
type note(Team meeting 2021-05-14) template
action Meeting template file
templater true

^button-myteammeeting

shabegom commented 3 years ago

Oh no! That's not supposed to be happening. Kind of defeats the point eh? I'll take a look.

Some troubleshooting questions:

DanF-88 commented 3 years ago

I’m running Obsidian v0.12.3 Buttons 0.4.5 Templater 1.6.0 MacOS 11.3.1 (All latest for this date)

Same problem occurs if the split parameter is present

I have text before and after the button but no other blocks.

Here’s the log when I run it without a split argument: main.ts:121 TRIGGERED TRIGGERED buttonTypes.ts:226 Uncaught (in promise) TypeError: Cannot read property 'split' of undefined at eval (eval at (app.js:1), :1291:69) eval @ buttonTypes.ts:226 setTimeout (async) templater @ buttonTypes.ts:221 async function (async) templater @ buttonTypes.ts:212 clickHandler @ button.ts:49 async function (async) clickHandler @ button.ts:43 eval @ button.ts:31 s @ app.js:1

On 14 May 2021, at 17:40, Sam wrote:

Oh no! That's not supposed to be happening. Kind of defeats the point eh? I'll take a look.

Some troubleshooting questions:

  • version of obsidian, templater & buttons
  • what else is in the note with the button?
  • anything logged in the dev console?
  • is there any difference if you add the split arg to note?

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/shabegom/buttons/issues/38#issuecomment-841572455

shabegom commented 3 years ago

Excellent I know what the problem is. Now I just need to work out a solution. Will ship a fix as soon as I can.

shabegom commented 3 years ago

@DanF-88 I've just released 0.4.6 and this bug should now be fixed. Please give it a ty and let me know!