diff --git a/src/hooks/marriage/use-profile-main.ts b/src/hooks/marriage/use-profile-main.ts index 041f5d5..9adf54c 100644 --- a/src/hooks/marriage/use-profile-main.ts +++ b/src/hooks/marriage/use-profile-main.ts @@ -123,18 +123,34 @@ export function useMarriageProfileQuery( (old: MarriageProfileResponse | undefined) => { if (!old) return data; return { - ...old, ...data, - match_summary: data.match_summary ?? old.match_summary, - active_case: data.active_case ?? old.active_case, + ...old, + match_summary: old.match_summary ?? data.match_summary, + active_case: old.active_case ?? data.active_case, active_subscription: - data.active_subscription ?? old.active_subscription, + old.active_subscription ?? data.active_subscription, + recommended_plan: + old.recommended_plan ?? data.recommended_plan, }; }, ); if (data.id && (data.match_summary || data.status)) { - saveScopedMarriageProfile(data); + const currentPersisted = getScopedMarriageProfile(); + const merged = { + ...data, + ...(currentPersisted || {}), + match_summary: + currentPersisted?.match_summary ?? data.match_summary, + active_case: + currentPersisted?.active_case ?? data.active_case, + recommended_plan: + currentPersisted?.recommended_plan ?? data.recommended_plan, + active_subscription: + currentPersisted?.active_subscription ?? + data.active_subscription, + }; + saveScopedMarriageProfile(merged); } } }