fix(app): show project sessions before path sync resolves (#30167)
Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com>
This commit is contained in:
parent
a9c115c220
commit
2725eed992
3 changed files with 72 additions and 4 deletions
|
|
@ -52,7 +52,7 @@ beforeAll(async () => {
|
|||
useQueries: (options: () => { queries: Array<{ enabled?: boolean }> }) => {
|
||||
queryGroups.push(options)
|
||||
return [
|
||||
{ isLoading: false, data: { state: "", config: "", worktree: "", directory: "", home: "" } },
|
||||
{ isLoading: true, data: undefined },
|
||||
{ isLoading: false, data: {} },
|
||||
{ isLoading: false, data: [] },
|
||||
{ isLoading: false, data: provider },
|
||||
|
|
@ -128,6 +128,35 @@ describe("createChildStoreManager", () => {
|
|||
}
|
||||
})
|
||||
|
||||
test("provides the requested directory while the path query is pending", () => {
|
||||
let manager: ReturnType<typeof createChildStoreManager> | undefined
|
||||
|
||||
const dispose = createOwner((owner) => {
|
||||
manager = createChildStoreManager({
|
||||
owner,
|
||||
isBooting: () => false,
|
||||
isLoadingSessions: () => false,
|
||||
onBootstrap() {},
|
||||
onMcp() {},
|
||||
onDispose() {},
|
||||
translate: (key) => key,
|
||||
queryOptions: queryOptionsApi,
|
||||
global: { provider },
|
||||
})
|
||||
})
|
||||
|
||||
try {
|
||||
if (!manager) throw new Error("manager required")
|
||||
|
||||
const [store] = manager.child("/project", { bootstrap: false })
|
||||
|
||||
expect(store.path.directory).toBe("/project")
|
||||
expect(store.path.worktree).toBe("")
|
||||
} finally {
|
||||
dispose()
|
||||
}
|
||||
})
|
||||
|
||||
test("enables MCP only when requested for the directory", () => {
|
||||
let manager: ReturnType<typeof createChildStoreManager> | undefined
|
||||
const offset = queryGroups.length
|
||||
|
|
|
|||
|
|
@ -204,9 +204,8 @@ export function createChildStoreManager(input: {
|
|||
},
|
||||
config: {},
|
||||
get path() {
|
||||
if (pathQuery.isLoading || !pathQuery.data)
|
||||
return { state: "", config: "", worktree: "", directory: "", home: "" }
|
||||
return pathQuery.data
|
||||
if (pathQuery.data) return pathQuery.data
|
||||
return { state: "", config: "", worktree: "", directory, home: "" }
|
||||
},
|
||||
status: "loading" as const,
|
||||
agent: [],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue