|
|
|
@ -149,22 +149,28 @@ export function applyProfilePatchResultToCache( |
|
|
|
const slug = String(queryKey[3] ?? ""); |
|
|
|
queryClient.setQueryData(queryKey, patchSection(current, slug)); |
|
|
|
}); |
|
|
|
queryClient.setQueryData( |
|
|
|
marriageQueryKeys.formOverview("profile", locale), |
|
|
|
(current: any) => |
|
|
|
current |
|
|
|
? { |
|
|
|
...current, |
|
|
|
progress: data.progress, |
|
|
|
sections: current.sections.map((section: any) => { |
|
|
|
const progress = |
|
|
|
data.affected_sections[section.id] ?? |
|
|
|
data.progress.sections_progress[section.id]; |
|
|
|
return progress ? { ...section, progress } : section; |
|
|
|
}), |
|
|
|
} |
|
|
|
: current, |
|
|
|
); |
|
|
|
queryClient |
|
|
|
.getQueriesData({ |
|
|
|
queryKey: [...marriageQueryKeys.all, "form-overview"], |
|
|
|
}) |
|
|
|
.forEach(([queryKey, current]: [any, any]) => { |
|
|
|
if (!current) return; |
|
|
|
queryClient.setQueryData(queryKey, { |
|
|
|
...current, |
|
|
|
progress: data.progress, |
|
|
|
sections: current.sections?.map((section: any) => { |
|
|
|
const progress = |
|
|
|
data.affected_sections[section.id] ?? |
|
|
|
data.progress?.sections_progress?.[section.id]; |
|
|
|
return progress ? { ...section, progress } : section; |
|
|
|
}), |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
void queryClient.invalidateQueries({ |
|
|
|
queryKey: [...marriageQueryKeys.all, "form-overview"], |
|
|
|
exact: false, |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
export function useMarriageSectionDataQuery( |
|
|
|
|