diff --git a/README.md b/README.md index f615d8f..e798d2b 100644 --- a/README.md +++ b/README.md @@ -95,14 +95,14 @@ pnpm fetch:scenarios pnpm dev # → http://127.0.0.1:5173 # tests -pnpm test # vitest, 18 tests across api, live, - # synthetic, layout +pnpm test # vitest, 22 tests across api, live, + # synthetic, layout, store # build pnpm build # tsc + vite, single chunk ~225 KB gz # end-to-end smoke + screenshots -pnpm qa:smoke # playwright headless, 26 assertions +pnpm qa:smoke # playwright headless, 28 assertions # DOM layout audit pnpm qa:layout diff --git a/src/state/store.ts b/src/state/store.ts index b12d27b..8ebbbbf 100644 --- a/src/state/store.ts +++ b/src/state/store.ts @@ -83,14 +83,15 @@ async function runLiveFetch( const { scenarios, workItems, distinctDefs } = await buildLiveScenariosFromApi(); const merged = [...scenarios, ...syntheticScenarios]; const first = merged[0]; - const keepCurrent = get().scenarios.some((s) => s.id === get().scenarioId); + const currentId = get().scenarioId; + const stillThere = merged.find((s) => s.id === currentId); set({ scenarios: merged, liveTotals: { workItems: workItems.length, distinctDefs }, liveFetchedAt: Date.now(), liveLoading: false, - scenarioId: keepCurrent ? get().scenarioId : first?.id ?? get().scenarioId, - selectedStepId: keepCurrent ? get().selectedStepId : first?.defaultStepId ?? null, + scenarioId: stillThere ? currentId : first?.id ?? currentId, + selectedStepId: stillThere ? get().selectedStepId : first?.defaultStepId ?? null, }); get().pushToast( "ok",