fix(capital): await onSaved before advancing wizard past БЛАГОРОСТ step
Typecheck / desktop (pull_request) Failing after 8m49s
Typecheck / controller (pull_request) Successful in 13m45s

goNext() checked getFirstAvailableCouncilGroup() (which reads isDocParamsReady,
derived from onboardingState.capital_program_doc_data_hash) synchronously right
after saveParams() resolved. But saveParams() fired options.onSaved(hash) without
awaiting it, and the card's onSaved handler did `void handleDocParamsSaved()` —
an async refetch of onboarding state — so isDocParamsReady was still stale at the
moment goNext() decided which council group to jump to. getFirstAvailableCouncilGroup()
returned null, setWizardStepKey never ran, and the wizard just re-rendered the same
БЛАГОРОСТ step, looking like the just-saved params were never registered.

Fix: onSaved is now awaited inside saveParams(), and the card passes the
handleDocParamsSaved() promise through instead of firing it and forgetting it.
This commit is contained in:
coopops
2026-07-18 18:27:57 +00:00
parent b5eb0ea51f
commit bbc6453b24
2 changed files with 3 additions and 5 deletions
@@ -37,7 +37,7 @@ function createEmptyForm(): Record<EditableFieldKey, string> {
return Object.fromEntries(ALL_DOC_FIELDS.map((key) => [key, ''])) as Record<EditableFieldKey, string>;
}
export function useCapitalProgramDocParams(options?: { onSaved?: (hash: string) => void }) {
export function useCapitalProgramDocParams(options?: { onSaved?: (hash: string) => void | Promise<void> }) {
const $q = useQuasar();
const systemStore = useSystemStore();
const sessionStore = useSessionStore();
@@ -172,7 +172,7 @@ export function useCapitalProgramDocParams(options?: { onSaved?: (hash: string)
savedHash.value = hash;
persistDraftToStorage();
options?.onSaved?.(hash);
await options?.onSaved?.(hash);
$q.notify({
type: 'positive',
@@ -150,9 +150,7 @@ const {
saveParams,
setWizardStepKey,
} = useCapitalProgramDocParams({
onSaved: () => {
void handleDocParamsSaved();
},
onSaved: () => handleDocParamsSaved(),
});
const activeWizardStep = wizardStepKey;