Fix: late draft-resume no longer clobbers in-progress wizard input
draftSync.resume() does async network work and dispatched Seed on completion, which could land after the user's first action and reset the machine (cursor + fields) — the "click Volgende twice" symptom. Guard centrally: applyResume() skips when the user already has progress (snapshot() != null) or there's nothing to restore. onResume is now only ever called with a real draft on a pristine machine, so the three wizard callbacks drop the dead `?? initial`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -102,7 +102,7 @@ export class HerregistratieWizardComponent {
|
||||
const documentIds = deliveryRefs(s.upload).filter((r) => r.channel === 'digital' && r.documentId).map((r) => r.documentId!);
|
||||
return { draft: s, stepIndex: s.step - 1, stepCount: this.stepLabels.length, documentIds };
|
||||
},
|
||||
onResume: (draft) => this.dispatch({ tag: 'Seed', state: (draft as WizardState | null) ?? initial }),
|
||||
onResume: (draft) => this.dispatch({ tag: 'Seed', state: draft as WizardState }),
|
||||
enabled: () => this.seed() === initial,
|
||||
});
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ export class IntakeWizardComponent {
|
||||
if (s.tag !== 'Answering' || !hasProgress(s)) return null;
|
||||
return { draft: s, stepIndex: s.cursor, stepCount: STEPS.length, documentIds: [] };
|
||||
},
|
||||
onResume: (draft) => this.dispatch({ tag: 'Seed', state: (draft as IntakeState | null) ?? initial }),
|
||||
onResume: (draft) => this.dispatch({ tag: 'Seed', state: draft as IntakeState }),
|
||||
enabled: () => this.seed() === initial,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user