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

tp.user command in type note makes button dissapear #212

Open
ZobaJakColbert opened this issue Feb 13, 2024 · 7 comments
Open

tp.user command in type note makes button dissapear #212

ZobaJakColbert opened this issue Feb 13, 2024 · 7 comments

Comments

@ZobaJakColbert
Copy link

ZobaJakColbert commented Feb 13, 2024

I was using this code to add new accumulator to my collection. It was getting current number of accu and adding one with .js script named: getThisAcumulatorNum. But now button don't show up. If I remove this line <% tp.user.getThisAcumulatorNum(tp, "AA") %> button reappears. How to fix this?

```button
name Add accu AA
type note(Accu/AA/<% tp.user.getThisAcumulatorNum(tp, "AA") %>, split) template
action Template - Accu
templater true
\```

remove "\" before last "```"

@cacharbe
Copy link

cacharbe commented Feb 15, 2024

I'm seeing this behavior as well with embedded tp.user commands causing the button to not render.

From Console:

app.js:1 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'path')
at t. (app.js:1:722944)
at app.js:1:237258
at Object.next (app.js:1:237363)
at app.js:1:236279
at new Promise ()
at v (app.js:1:236024)
at t.read (app.js:1:722825)
at InternalModuleFile.generate_content (plugin:templater-obsidian:2402:28)
at InternalModuleFile.create_dynamic_templates (plugin:templater-obsidian:2395:54)
at InternalModuleFile.generate_object (plugin:templater-obsidian:2310:16)
at InternalFunctions.generate_object (plugin:templater-obsidian:2892:60)
at async templater$1 (plugin:buttons:989:23)
at async eval (plugin:buttons:4311:38)

@shabegom
Copy link
Owner

Very strange that the whole button disappears. I'm guessing the way user script plugins work have changed in some way since I implemented the handling.

@shabegom
Copy link
Owner

@ZobaJakColbert can you post the script code so I have a minimal reproducible example? I currently don't have a user scripts.

@cacharbe
Copy link

I have repro'd the bug with the following minimal (change txt to js file):

name Add GM Session
type note(foo/bar/<% tp.user.getInt(tp) %>, split) template
action session-gm
templater true

^button-NewInt

getInt.txt

@Tejeev
Copy link

Tejeev commented Apr 30, 2024

I am seeing this as well.
Templater: v2.2.3
Buttons: v0.5.1

@ZeroKun265
Copy link

ZeroKun265 commented Jul 24, 2024

I was just testing this out and yes, it gives e the same issues

```button
name prova
type note(prova) template
action template2
```
^button-vgor

```button
name prova2
type note(Mood-<%tp-date.now("HH")%>) template
action template1
templater true
```
^button-w4mx

The above button works but the second one does not
Templater: 2.4.1
Buttons: 0.5.1
(on a brand new vault for testing)

Edit: Found these errors in the console, which do not appear if i remove the broken buttons and reload obsidian (using the non broken buttons does not spawn the errors)
image

@utherbit
Copy link

utherbit commented Oct 3, 2024

I encountered this problem
Buttons: v0.5.1
Templater: v2.3.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants