Browse Source

desktop: use Show instead of Suspense

Brendan Allan 1 month ago
parent
commit
3c375b971e
2 changed files with 8 additions and 5 deletions
  1. 1 1
      packages/desktop/src-tauri/src/lib.rs
  2. 7 4
      packages/desktop/src/index.tsx

+ 1 - 1
packages/desktop/src-tauri/src/lib.rs

@@ -139,7 +139,7 @@ fn spawn_sidecar(app: &AppHandle, port: u32) -> CommandChild {
             .args([
                 "-il",
                 "-c",
-                &format!("{} serve --port={}", sidecar.display(), port),
+                &format!("\"{}\" serve --port={}", sidecar.display(), port),
             ])
             .spawn()
             .expect("Failed to spawn opencode")

+ 7 - 4
packages/desktop/src/index.tsx

@@ -18,6 +18,7 @@ import { Suspense, createResource, ParentProps } from "solid-js"
 import { UPDATER_ENABLED } from "./updater"
 import { createMenu } from "./menu"
 import pkg from "../package.json"
+import { Show } from "solid-js";
 
 const root = document.getElementById("root")
 if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
@@ -288,7 +289,9 @@ function ServerGate(props: ParentProps) {
   })
 
   return (
-    <Suspense
+    // Not using suspense as not all components are compatible with it (undefined refs)
+    <Show
+      when={status.state !== "pending"}
       fallback={
         <div class="h-screen w-screen flex flex-col items-center justify-center bg-background-base">
           <Logo class="w-xl opacity-12 animate-pulse" />
@@ -296,9 +299,9 @@ function ServerGate(props: ParentProps) {
         </div>
       }
     >
-      {/* Triggers suspense/error boundaries without rendering the returned value */}
+      {/* Trigger error boundary without rendering the returned value */}
       {(status(), null)}
-      <Suspense>{props.children}</Suspense>
-    </Suspense>
+      {props.children}
+    </Show>
   )
 }