Просмотр исходного кода

fix(app): no flash of home page on start

Adam 1 месяц назад
Родитель
Сommit
04e60f2b3d
1 измененных файлов с 14 добавлено и 1 удалено
  1. 14 1
      packages/app/src/pages/layout.tsx

+ 14 - 1
packages/app/src/pages/layout.tsx

@@ -120,6 +120,17 @@ export default function Layout(props: ParentProps) {
   })
   const editorRef = { current: undefined as HTMLInputElement | undefined }
 
+  const autoselecting = createMemo(() => {
+    if (params.dir) return false
+    if (initialDir) return false
+    if (!autoselect()) return false
+    if (!pageReady()) return true
+    if (!layoutReady()) return true
+    const list = layout.projects.list()
+    if (list.length === 0) return false
+    return true
+  })
+
   const editorOpen = (id: string) => editor.active === id
   const editorValue = () => editor.value
 
@@ -2194,7 +2205,9 @@ export default function Layout(props: ParentProps) {
             "xl:border-l xl:rounded-tl-sm": !layout.sidebar.opened(),
           }}
         >
-          {props.children}
+          <Show when={!autoselecting()} fallback={<div class="size-full" />}>
+            {props.children}
+          </Show>
         </main>
       </div>
       <Toast.Region />