Skip to content

Build your personal knowledge base with Trilium Notes

fix(client): skip loading keyboard actions on shared pages

Elian Doran7b6d3a1b0884
diff --git a/apps/client/src/services/keyboard_actions.ts b/apps/client/src/services/keyboard_actions.ts
index 716024049e..09cd22ba23 100644
--- a/apps/client/src/services/keyboard_actions.ts
+++ b/apps/client/src/services/keyboard_actions.ts
@@ -2,15 +2,16 @@ import server from "./server.js";
import appContext from "../components/app_context.js";
import { formatShortcut, joinShortcut } from "./keyboard_shortcut_display.js";
import shortcutService, { ShortcutBinding } from "./shortcuts.js";
-import { isPreAuthScreen } from "./utils.js";
+import { isPreAuthScreen, isShare } from "./utils.js";
import type Component from "../components/component.js";
import type { ActionKeyboardShortcut } from "@triliumnext/commons";
const keyboardActionRepo: Record<string, ActionKeyboardShortcut> = {};
// Skip on the login / set-password pre-auth screens, where an unauthenticated
-// GET /api/keyboard-actions would 401 (#10589); those screens bind no shortcuts.
-const keyboardActionsLoaded: Promise<ActionKeyboardShortcut[]> = isPreAuthScreen()
+// GET /api/keyboard-actions would 401 (#10589), and on shared pages, which have no API; neither
+// binds shortcuts.
+const keyboardActionsLoaded: Promise<ActionKeyboardShortcut[]> = isPreAuthScreen() || isShare
? Promise.resolve([])
: server.get<ActionKeyboardShortcut[]>("keyboard-actions").then((actions) => {
actions = actions.filter((a) => !!a.actionName); // filter out separators