Explorar el Código

fix(v0.6.2): use lazy() for AdminDashboard — was crashing renderer at startup

- Static import of PersonalDashboard caused renderer crash
- Changed to lazy(() => import()) like NewSession
- App now starts in 3 seconds
KirinCode hace 1 mes
padre
commit
77fabb93cf
Se han modificado 2 ficheros con 4 adiciones y 20 borrados
  1. 1 1
      packages/app/src/app.tsx
  2. 3 19
      packages/desktop/src/renderer/index.tsx

+ 1 - 1
packages/app/src/app.tsx

@@ -58,9 +58,9 @@ import { createSessionLineage } from "@/pages/session/session-lineage"
 
 import { SessionPage, SessionRouteErrorBoundary, TargetSessionRouteContent } from "@/pages/session"
 import { NewHome, LegacyHome } from "@/pages/home"
-import { PersonalDashboard } from "@/pages/admin/AdminDashboard"
 
 const NewSession = lazy(() => import("@/pages/new-session"))
+const PersonalDashboard = lazy(() => import("@/pages/admin/AdminDashboard").then(m => ({ default: m.PersonalDashboard })))
 
 const SessionRoute = () => {
   const settings = useSettings()

+ 3 - 19
packages/desktop/src/renderer/index.tsx

@@ -317,26 +317,10 @@ window.api.onMenuCommand((id) => {
 listenForDeepLinks()
 
 function LoadingSplash() {
-  const [dots, setDots] = createSignal("")
-  const [pc, setPc] = createSignal(20)
-  onMount(() => {
-    const i = setInterval(() => {
-      setDots(d => d.length >= 3 ? "" : d + ".")
-      setPc(p => p < 90 ? p + 5 : p)
-    }, 400)
-    return () => clearInterval(i)
-  })
   return (
-    <div class="h-dvh w-screen flex flex-col items-center justify-center bg-background-base gap-6">
-      <Splash class="w-16 h-20 opacity-60 animate-pulse" />
-      <div class="flex flex-col items-center gap-3">
-        <span class="text-14-medium text-text-muted">
-          正在启动 KirinCode<span class="inline-block w-8 text-left">{dots()}</span>
-        </span>
-        <div class="w-40 h-1.5 bg-background-element rounded-full overflow-hidden">
-          <div class="h-full bg-primary rounded-full transition-all duration-500" style={{width: `${pc()}%`}} />
-        </div>
-      </div>
+    <div class="h-dvh w-screen flex flex-col items-center justify-center bg-background-base">
+      <Splash class="w-16 h-20 opacity-50 animate-pulse" />
+      <span class="text-14-medium text-text-muted mt-4">正在启动 KirinCode</span>
     </div>
   )
 }