Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

refactor(desktop): mount app before resolving platform class

Richie McIlroya085307921f6
diff --git a/apps/desktop/src/entry-client.tsx b/apps/desktop/src/entry-client.tsx
index a44f61bdc..7b22b6705 100644
--- a/apps/desktop/src/entry-client.tsx
+++ b/apps/desktop/src/entry-client.tsx
@@ -1,19 +1,23 @@
// @refresh reload
import { mount, StartClient } from "@solidjs/start/client";
-async function initApp() {
- try {
- const { type } = await import("@tauri-apps/plugin-os");
- const osType = type();
- document.documentElement.classList.add(`platform-${osType}`);
- } catch (error) {
- console.error("Failed to get OS type:", error);
- }
+function initPlatformClass() {
+ import("@tauri-apps/plugin-os")
+ .then(({ type }) => {
+ const osType = type();
+ document.documentElement.classList.add(`platform-${osType}`);
+ })
+ .catch((error) => {
+ console.error("Failed to get OS type:", error);
+ });
+}
+function initApp() {
const app = document.getElementById("app");
if (!app) throw new Error("App root element not found");
mount(() => <StartClient />, app);
+ initPlatformClass();
}
initApp();