Skip to content

Commit ab69f41

Browse files
authored
fix(app): avoid suspending on pending child path (anomalyco#30314)
1 parent 687c662 commit ab69f41

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎packages/app/src/context/global-sync/child-store.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ beforeAll(async () => {
5656
return options().queryKey?.[1] === "path"
5757
},
5858
get data() {
59+
if (options().queryKey?.[1] === "path") throw new Error("pending path data read")
5960
if (options().queryKey?.[1] === "mcp") return options().enabled ? { demo: { status: "disabled" } } : undefined
6061
if (options().queryKey?.[1] === "lsp") return []
6162
if (options().queryKey?.[1] === "providers") return provider

‎packages/app/src/context/global-sync/child-store.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ export function createChildStoreManager(input: {
200200
},
201201
config: {},
202202
get path() {
203-
if (pathQuery.data) return pathQuery.data
204-
return { state: "", config: "", worktree: "", directory, home: "" }
203+
const EMPTY = { state: "", config: "", worktree: "", directory, home: "" }
204+
if (pathQuery.isLoading) return EMPTY
205+
return pathQuery.data ?? EMPTY
205206
},
206207
status: "loading" as const,
207208
agent: [],

0 commit comments

Comments
 (0)