test(frontend): cover NewSessionDialog model degradation + invalidate sessions on resume
- Add NewSessionDialog.test.tsx covering §9 graceful degradation:
empty models -> free-text input; non-empty models -> dropdown; plus a
createSession body-keys assertion
- Normalize model entries to {value,label} so object-shaped models
({provider,id}) render correctly in the dropdown (was assuming strings)
- NavSessions: invalidate the ["sessions"] query after a successful
resumeSession so the list/status refreshes immediately
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// frontend/src/shell/NavSessions.tsx
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { listSessions } from "../api/sessions";
|
||||
import { resumeSession } from "../api/sessions";
|
||||
import type { SessionSummary } from "../api/types";
|
||||
@@ -10,6 +10,7 @@ interface Props {
|
||||
}
|
||||
|
||||
export function NavSessions({ activeSessionId, onSessionSelect }: Props) {
|
||||
const queryClient = useQueryClient();
|
||||
const { data: sessions = [] } = useQuery<SessionSummary[]>({
|
||||
queryKey: ["sessions"],
|
||||
queryFn: listSessions,
|
||||
@@ -18,6 +19,7 @@ export function NavSessions({ activeSessionId, onSessionSelect }: Props) {
|
||||
|
||||
async function handleClick(id: string) {
|
||||
await resumeSession(id);
|
||||
queryClient.invalidateQueries({ queryKey: ["sessions"] });
|
||||
onSessionSelect(id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user