From 2e0e4c08e896967c2b80b182da3f79d663b4e16a Mon Sep 17 00:00:00 2001 From: Shad Date: Sun, 14 Jun 2026 00:30:57 +0400 Subject: [PATCH] docs+store: oracle r3 follow-ups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - README test/smoke counts: 18→22, 26→28 (drifted across rounds) - runLiveFetch keepCurrent now checks the MERGED catalog, not the old state — fixes the edge case where a scenarioId disappears between refreshes (would have orphaned the active scenario) Constraint: no test changes; pure cleanup Confidence: high Scope-risk: narrow --- README.md | 6 +++--- src/state/store.ts | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) 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",