Browse Source

fix(app): unnecessary suspense flash

adamelmore 4 weeks ago
parent
commit
8d1a66d043
1 changed files with 10 additions and 3 deletions
  1. 10 3
      packages/app/src/components/dialog-select-server.tsx

+ 10 - 3
packages/app/src/components/dialog-select-server.tsx

@@ -147,7 +147,14 @@ export function DialogSelectServer() {
       status: undefined as boolean | undefined,
       status: undefined as boolean | undefined,
     },
     },
   })
   })
-  const [defaultUrl, defaultUrlActions] = createResource(() => platform.getDefaultServerUrl?.())
+  const [defaultUrl, defaultUrlActions] = createResource(
+    async () => {
+      const url = await platform.getDefaultServerUrl?.()
+      if (!url) return null
+      return normalizeServerUrl(url) ?? null
+    },
+    { initialValue: null },
+  )
   const isDesktop = platform.platform === "desktop"
   const isDesktop = platform.platform === "desktop"
 
 
   const looksComplete = (value: string) => {
   const looksComplete = (value: string) => {
@@ -502,7 +509,7 @@ export function DialogSelectServer() {
                             <DropdownMenu.Item
                             <DropdownMenu.Item
                               onSelect={async () => {
                               onSelect={async () => {
                                 await platform.setDefaultServerUrl?.(i)
                                 await platform.setDefaultServerUrl?.(i)
-                                defaultUrlActions.refetch(i)
+                                defaultUrlActions.mutate(i)
                               }}
                               }}
                             >
                             >
                               <DropdownMenu.ItemLabel>
                               <DropdownMenu.ItemLabel>
@@ -514,7 +521,7 @@ export function DialogSelectServer() {
                             <DropdownMenu.Item
                             <DropdownMenu.Item
                               onSelect={async () => {
                               onSelect={async () => {
                                 await platform.setDefaultServerUrl?.(null)
                                 await platform.setDefaultServerUrl?.(null)
-                                defaultUrlActions.refetch(null)
+                                defaultUrlActions.mutate(null)
                               }}
                               }}
                             >
                             >
                               <DropdownMenu.ItemLabel>
                               <DropdownMenu.ItemLabel>