refactor: migrate the 3 wizards to the effect map and Primary (RD-08)
The three wizards paired a dispatch with a hand-written effect call (onPrimary/onRetry + runIfSubmitting/runIfIndienen). A missed call failed silently. RD-05 added the effect map and RD-07 added the Primary message; this ticket moves each wizard onto both. Each wizard now registers its submit effect on createStore, keyed by its own submitting tag (Submitting for herregistratie and intake, Indienen for registratie — the type catches a wrong key at compile time). The optimistic begin/confirm/rollback calls stay inside the effect body, unchanged. The template dispatches Primary and Retry directly, matching how Back already worked. onPrimary, onRetry, and runIfSubmitting/runIfIndienen are deleted from all three components. herregistratie-wizard drops under the 250-rule-line budget, so its eslint-disable max-lines header is removed in this same commit (RD-02's self-cleaning mechanism). intake-wizard and registratie-wizard stay over budget and keep theirs, both already flagged for RD-22/RD-23. Three doc comments (in the three machine files, plus one in store.ts) named the deleted onPrimary()/runIfSubmitting() identifiers in prose. Reworded them so the "idiom is gone from the repo" grep check is not defeated by its own explanatory comments. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -122,7 +122,7 @@ export function submit(s: WizardState): WizardState {
|
||||
}
|
||||
|
||||
/** The primary button's action: advance, or submit from the last step. No-op
|
||||
outside Editing — this is the one decision `onPrimary()` used to make. */
|
||||
outside Editing — this is the one decision the old component-side handler used to make. */
|
||||
export function primary(s: WizardState): WizardState {
|
||||
if (s.tag !== 'Editing') return s;
|
||||
return s.step === 3 ? submit(s) : next(s);
|
||||
|
||||
@@ -201,7 +201,7 @@ export function submit(s: IntakeState): IntakeState {
|
||||
}
|
||||
|
||||
/** The primary button's action: advance, or submit from the review step. No-op
|
||||
outside Answering — this is the one decision `onPrimary()` used to make. */
|
||||
outside Answering — this is the one decision the old component-side handler used to make. */
|
||||
export function primary(s: IntakeState): IntakeState {
|
||||
if (s.tag !== 'Answering') return s;
|
||||
return currentStep(s) === 'review' ? submit(s) : next(s);
|
||||
|
||||
Reference in New Issue
Block a user