Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(client): one more ineffective dynamic import due to appContext
Elian Doran09258179f021
diff --git a/apps/client/src/services/server.ts b/apps/client/src/services/server.tsindex 1db7454182..bb32b37ac9 100644--- a/apps/client/src/services/server.ts+++ b/apps/client/src/services/server.ts@@ -35,9 +35,7 @@ async function getHeaders(headers?: Headers) {return {};}- // Dynamic import to avoid circular dependency (app_context imports froca which imports server).- const appContext = (await import("../components/app_context.js")).default;- const activeNoteContext = appContext.tabManager ? appContext.tabManager.getActiveContext() : null;+ const activeNoteContext = glob.appContext?.tabManager ? glob.appContext.tabManager.getActiveContext() : null;// headers need to be lowercase because node.js automatically converts them to lower case// also avoiding using underscores instead of dashes since nginx filters them out by defaultdiff --git a/apps/client/src/services/utils.ts b/apps/client/src/services/utils.tsindex bcd817b6e2..09d71cc678 100644--- a/apps/client/src/services/utils.ts+++ b/apps/client/src/services/utils.ts@@ -455,9 +455,7 @@ export function openInAppHelpFromUrl(inAppHelpPage: string) {export async function openInReusableSplit(targetNoteId: string, targetViewMode: ViewMode, openOpts: {hoistedNoteId?: string;} = {}) {- // Dynamic import to avoid circular dependency (app_context imports utils).- const appContext = (await import("../components/app_context.js")).default;- const activeContext = appContext.tabManager.getActiveContext();+ const activeContext = glob.appContext?.tabManager.getActiveContext();if (!activeContext) {return;}@@ -467,7 +465,7 @@ export async function openInReusableSplit(targetNoteId: string, targetViewMode:if (!existingSubcontext) {// The target split is not already open, open a new split with it.const { ntxId } = subContexts[subContexts.length - 1];- appContext.triggerCommand("openNewNoteSplit", {+ glob.appContext?.triggerCommand("openNewNoteSplit", {ntxId,notePath: targetNoteId,hoistedNoteId: openOpts.hoistedNoteId,