fix(capital): await onSaved before advancing wizard past БЛАГОРОСТ step
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:
+2
-2
@@ -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',
|
||||
|
||||
+1
-3
@@ -150,9 +150,7 @@ const {
|
||||
saveParams,
|
||||
setWizardStepKey,
|
||||
} = useCapitalProgramDocParams({
|
||||
onSaved: () => {
|
||||
void handleDocParamsSaved();
|
||||
},
|
||||
onSaved: () => handleDocParamsSaved(),
|
||||
});
|
||||
|
||||
const activeWizardStep = wizardStepKey;
|
||||
|
||||
Reference in New Issue
Block a user