Skip to content

Build your personal knowledge base with Trilium Notes

feat(script): add warning if trying to render a protected note without the session active

Elian Doran1121ee0133ee
diff --git a/apps/client/src/services/render.tsx b/apps/client/src/services/render.tsx
index 682efa8871..31450b3a82 100644
--- a/apps/client/src/services/render.tsx
+++ b/apps/client/src/services/render.tsx
@@ -18,6 +18,10 @@ async function render(note: FNote, $el: JQuery<HTMLElement>, onError?: ErrorHand
for (const renderNoteId of renderNoteIds) {
const bundle = await server.postWithSilentInternalServerError<Bundle>(`script/bundle/${renderNoteId}`);
+ if (!bundle) {
+ throw new Error(`Script note '${renderNoteId}' could not be loaded. It may be protected and require an active protected session.`);
+ }
+
const $scriptContainer = $("<div>");
$el.append($scriptContainer);