api.getNote(<jsBackendNoteId>) Executes Note #9331
Replies: 4 comments 2 replies
-
|
Hi @MatthewColvin! I'm Dosu and I’m helping the Trilium team. Looking at the codebase, api.getNote() is a simple wrapper that just does a dictionary lookup in Becca (the in-memory cache) - it has no execution logic. So you're right that auto-execution is not intended behavior. A few things to check that might explain the unexpected execution:
As for running backend notes programmatically, there's no public To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Beta Was this translation helpful? Give feedback.
-
|
There are no labels or attributes on this JS backend note. The execution is coming from the widget and i can gather more info if you have a way for me to do thatbut the call is for sure executing the script. Thanks for agreeing on the api.runNote suggestion can you file a ticket on that? |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for confirming there are no labels/relations on the note - that rules out the scheduled/event-driven triggers. This does seem like unexpected behavior worth investigating further. For debugging, it would help to see:
Unfortunately, I can't file tickets myself - I'm just an AI assistant without the ability to create GitHub issues. You'd need to open a separate feature request for To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Beta Was this translation helpful? Give feedback.
-
|
@MatthewColvin , since you are in a front-end script (widget), you can already execute a backend script on demand via: const note = await api.getNote(noteId);
await note.executeScript();Note that this needs to be run on the frontend and not backend (e.g. wrapped in a Notes are not run automatically upon |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I have a custom widget that can run back end notes.
It uses api.runOnBackend() to help with this.
From the widget...
I validated this is due to the fact the note is labaled as a JS backend note. i.e. type=application/javascript;env=backend because if I just change to plan text the note is not ran when calling api.getNote().
Claude really really wants there to be a runNote(noteId) API which would really help with my use case.
Never the less I don't think the intention is for a getNote call to actually exectue the note if that is expected then feel free to just close this up.
TriliumNext Version
0.102.1
What operating system are you using?
Ubuntu
What is your setup?
Local + server sync
Operating System Version
Ubuntu 22.04
Error logs
No response
Beta Was this translation helpful? Give feedback.
All reactions