You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open the dev console, execute the script, and an error occurs: Error: server error: Load of script note "<note title>" (<note id>) failed with: Cannot read property '<note id>' of undefined"
Similarly, api.getBranch and api.getAttribute also cause errors.
Additional Information
Replacing api.getNote with becca.getNote works (as well as becca.getBranch and becca.getAttribute).
The issue seems to be these three methods on BackendScriptApi are assigned their respective becca methods, and the becca methods use this which is undefined when the backend methods are called:
Preflight Checklist
Trilium Version
0.48.1-beta
What operating system are you using?
Windows
What is your setup?
Local (no sync)
Operating System Version
Windows 10 21H1
Expected Behavior
The backend
api.getNote
,api.getBranch
, andapi.getAttribute
methods shouldn't cause an error.Actual Behavior
Create a JS frontend code note:
Open the dev console, execute the script, and an error occurs:
Error: server error: Load of script note "<note title>" (<note id>) failed with: Cannot read property '<note id>' of undefined"
Similarly,
api.getBranch
andapi.getAttribute
also cause errors.Additional Information
Replacing
api.getNote
withbecca.getNote
works (as well asbecca.getBranch
andbecca.getAttribute
).The issue seems to be these three methods on
BackendScriptApi
are assigned their respectivebecca
methods, and thebecca
methods usethis
which is undefined when the backend methods are called:trilium/src/services/backend_script_api.js
Lines 61 to 75 in 21d2ca3
The text was updated successfully, but these errors were encountered: