refactor(brief): move the action lifecycle into the machine (RD-12)
The action lifecycle (Idle | Busy | Failed) lived in an imperative store-level signal, set from ten call sites outside the reducer. The reducer could not enforce which action transitions are legal. Add `action` to `BriefState.Loaded`, driven by three new messages (ActionStarted, ActionFinished, ActionFailed) and handled in `reduce`. Replace every `actionState.set(...)` call in `brief.store.ts` with the matching `dispatch`. `BriefLoaded` resets `action` to Idle, so a fresh load clears a stale action error instead of letting it outlive the reload. `busy` and `lastError` stay as `computed`s on the store with a byte-identical public signature — they are the render seam for four components and two page templates, and the union belongs in the machine, not the components. `revealBigNummer` still sets only `Failed`, never `Busy` — an existing asymmetry, not changed here. `SaveState`, `org-template.store.ts`, and `pendingPublish` are out of scope (RD-13, RD-14). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ tested where._
|
||||
|
||||
Every bullet below is a real test name from the suite — an `it()` title (frontend) or a test
|
||||
method name (backend), read as a sentence. Nothing here is hand-written prose: this page
|
||||
**is** the suite, reshaped for a business reader. 519 frontend behaviours across
|
||||
**is** the suite, reshaped for a business reader. 524 frontend behaviours across
|
||||
9 contexts; 261 backend behaviours across 42 test
|
||||
classes.
|
||||
|
||||
@@ -260,6 +260,11 @@ classes.
|
||||
- approve fires only from submitted
|
||||
- reject fires from submitted, carrying comments
|
||||
- send fires only from approved
|
||||
- ActionStarted moves a loaded brief to Busy
|
||||
- ActionFailed carries the error
|
||||
- ActionFinished returns to Idle
|
||||
- BriefLoaded resets a stale action error to Idle
|
||||
- an action message is a no-op when the brief is not loaded
|
||||
- a status transition replaces decisions with the fresh server value
|
||||
|
||||
#### diffBlocks
|
||||
|
||||
Reference in New Issue
Block a user