diff --git a/apps/client/src/index.ts b/apps/client/src/index.ts index dcc5feeb2a..5d750fc865 100644 --- a/apps/client/src/index.ts +++ b/apps/client/src/index.ts @@ -112,6 +112,8 @@ function loadIcons() { } function setBodyAttributes() { + if (!glob.isDbInitialized) return; + const { device, headingStyle, layoutOrientation, platform, isElectron, hasNativeTitleBar, hasBackgroundEffects, currentLocale } = window.glob; const classesToSet = [ device, @@ -132,6 +134,11 @@ function setBodyAttributes() { } async function loadScripts() { + if (!glob.dbInitialized) { + await import("./setup.js"); + return; + } + switch (glob.device) { case "mobile": await import("./mobile.js"); diff --git a/apps/client/src/setup.tsx b/apps/client/src/setup.tsx new file mode 100644 index 0000000000..519da828f1 --- /dev/null +++ b/apps/client/src/setup.tsx @@ -0,0 +1,13 @@ +import { render } from "preact"; + +async function main() { + const bodyWrapper = document.createElement("div"); + render(, bodyWrapper); + document.body.appendChild(bodyWrapper); +} + +function App() { + return

Loading...

; +} + +main(); diff --git a/apps/client/src/setup.ts b/apps/client/src/setup_old.ts similarity index 100% rename from apps/client/src/setup.ts rename to apps/client/src/setup_old.ts diff --git a/apps/client/src/types.d.ts b/apps/client/src/types.d.ts index 545ff8e029..4a7401ab3a 100644 --- a/apps/client/src/types.d.ts +++ b/apps/client/src/types.d.ts @@ -16,6 +16,7 @@ interface ElectronProcess { } interface CustomGlobals extends BootstrapDefinition { + isDbInitialized: boolean; isDesktop: typeof utils.isDesktop; isMobile: typeof utils.isMobile; getComponentByEl: typeof appContext.getComponentByEl;