Browse Source

fix(app): avoid suspending on pending child path (#30314)

Luke Parker 3 months ago
parent
commit
ab69f41067

+ 1 - 0
packages/app/src/context/global-sync/child-store.test.ts

@@ -56,6 +56,7 @@ beforeAll(async () => {
           return options().queryKey?.[1] === "path"
         },
         get data() {
+          if (options().queryKey?.[1] === "path") throw new Error("pending path data read")
           if (options().queryKey?.[1] === "mcp") return options().enabled ? { demo: { status: "disabled" } } : undefined
           if (options().queryKey?.[1] === "lsp") return []
           if (options().queryKey?.[1] === "providers") return provider

+ 3 - 2
packages/app/src/context/global-sync/child-store.ts

@@ -200,8 +200,9 @@ export function createChildStoreManager(input: {
             },
             config: {},
             get path() {
-              if (pathQuery.data) return pathQuery.data
-              return { state: "", config: "", worktree: "", directory, home: "" }
+              const EMPTY = { state: "", config: "", worktree: "", directory, home: "" }
+              if (pathQuery.isLoading) return EMPTY
+              return pathQuery.data ?? EMPTY
             },
             status: "loading" as const,
             agent: [],