Skip to content

Build your personal knowledge base with Trilium Notes

refactor(client): circular dependency causing test failure

Elian Doranefdf79feaa08
diff --git a/apps/client/src/components/app_context.ts b/apps/client/src/components/app_context.ts
index 0cf5058ed6..4430145720 100644
--- a/apps/client/src/components/app_context.ts
+++ b/apps/client/src/components/app_context.ts
@@ -1,5 +1,4 @@
import froca from "../services/froca.js";
-import bundleService from "../services/bundle.js";
import RootCommandExecutor from "./root_command_executor.js";
import Entrypoints, { type SqlExecuteResults } from "./entrypoints.js";
import options from "../services/options.js";
@@ -470,6 +469,7 @@ export class AppContext extends Component {
this.tabManager.loadTabs();
+ const bundleService = (await import("../services/bundle.js")).default;
setTimeout(() => bundleService.executeStartupBundles(), 2000);
}
diff --git a/apps/client/src/services/script_context.ts b/apps/client/src/services/script_context.ts
index 27a8a7d441..7c15db1aef 100644
--- a/apps/client/src/services/script_context.ts
+++ b/apps/client/src/services/script_context.ts
@@ -1,4 +1,4 @@
-import FrontendScriptApi, { type Entity } from "./frontend_script_api.js";
+import type { Entity } from "./frontend_script_api.js";
import utils from "./utils.js";
import froca from "./froca.js";
@@ -14,6 +14,8 @@ async function ScriptContext(startNoteId: string, allNoteIds: string[], originEn
throw new Error(`Could not find start note ${startNoteId}.`);
}
+ const FrontendScriptApi = (await import("./frontend_script_api.js")).default;
+
return {
modules: modules,
notes: utils.toObject(allNotes, (note) => [note.noteId, note]),