fix(tui): load root sessions in switcher (#37784)
Co-authored-by: Dax Raad <d@ironbay.co>
This commit is contained in:
parent
bef6cfbffe
commit
f05d2ab551
2 changed files with 31 additions and 0 deletions
|
|
@ -1294,6 +1294,7 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({
|
||||||
project: location.project.id,
|
project: location.project.id,
|
||||||
limit: 50,
|
limit: 50,
|
||||||
order: "desc",
|
order: "desc",
|
||||||
|
parentID: null,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,36 @@ function durable(sessionID: string, seq = 0, version = 1) {
|
||||||
return { aggregateID: sessionID, seq, version }
|
return { aggregateID: sessionID, seq, version }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test("preloads root sessions before applying the session limit", async () => {
|
||||||
|
const events = createEventStream()
|
||||||
|
let request: URL | undefined
|
||||||
|
const calls = createFetch((url) => {
|
||||||
|
if (url.pathname === "/api/session") request = url
|
||||||
|
return undefined
|
||||||
|
}, events)
|
||||||
|
|
||||||
|
const app = await testRender(() => (
|
||||||
|
<TestTuiContexts>
|
||||||
|
<ClientProvider api={createApi(calls.fetch)}>
|
||||||
|
<ProjectProvider>
|
||||||
|
<DataProvider>
|
||||||
|
<box />
|
||||||
|
</DataProvider>
|
||||||
|
</ProjectProvider>
|
||||||
|
</ClientProvider>
|
||||||
|
</TestTuiContexts>
|
||||||
|
))
|
||||||
|
|
||||||
|
try {
|
||||||
|
await wait(() => request !== undefined)
|
||||||
|
expect(request?.searchParams.get("project")).toBe("proj_test")
|
||||||
|
expect(request?.searchParams.get("limit")).toBe("50")
|
||||||
|
expect(request?.searchParams.get("parentID")).toBe("null")
|
||||||
|
} finally {
|
||||||
|
app.renderer.destroy()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
test("bootstraps MCP data for the TUI location", async () => {
|
test("bootstraps MCP data for the TUI location", async () => {
|
||||||
const events = createEventStream()
|
const events = createEventStream()
|
||||||
const requests: URL[] = []
|
const requests: URL[] = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue