From 84c535ae0ded0a4d8137300389e6b9cf6df04774 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 27 Jul 2024 16:45:02 +0300 Subject: [PATCH] electron: Fix "Cannot access 'sqlInit' before initialization" at startup --- src/becca/becca_loader.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/becca/becca_loader.ts b/src/becca/becca_loader.ts index 041bdccbd..9df2362ed 100644 --- a/src/becca/becca_loader.ts +++ b/src/becca/becca_loader.ts @@ -3,7 +3,6 @@ import sql from "../services/sql.js"; import eventService from "../services/events.js"; import becca from "./becca.js"; -import sqlInit from "../services/sql_init.js"; import log from "../services/log.js"; import BNote from "./entities/bnote.js"; import BBranch from "./entities/bbranch.js"; @@ -17,7 +16,8 @@ import AbstractBeccaEntity from "./entities/abstract_becca_entity.js"; import options_init from "../services/options_init.js"; import ws from "../services/ws.js"; -const beccaLoaded = new Promise((res, rej) => { +const beccaLoaded = new Promise(async (res, rej) => { + const sqlInit = (await import("../services/sql_init.js")).default; sqlInit.dbReady.then(() => { cls.init(() => { load();