diff --git a/src/app/candidate-contact/candidate-contact-client.tsx b/src/app/candidate-contact/candidate-contact-client.tsx index 62c850e..6361447 100644 --- a/src/app/candidate-contact/candidate-contact-client.tsx +++ b/src/app/candidate-contact/candidate-contact-client.tsx @@ -311,10 +311,11 @@ export default function CandidateContactClient() { onClose={closeAdvisors} /> - + ); } @@ -405,6 +406,7 @@ export default function CandidateContactClient() { diff --git a/src/app/new-match/new-match-client.tsx b/src/app/new-match/new-match-client.tsx index 23f8ec8..44669f5 100644 --- a/src/app/new-match/new-match-client.tsx +++ b/src/app/new-match/new-match-client.tsx @@ -1144,7 +1144,11 @@ export default function NewMatchClient() { - + {showPaymentSuccessToast && ( void; + profile?: MarriageProfile; }; export default function NewMatchProfilePage({ onClose, + profile: profileProp, }: NewMatchProfilePageProps = {}) { const { dictionary: t, locale } = useI18n(); const router = useRouter(); @@ -280,10 +282,15 @@ export default function NewMatchProfilePage({ const [isDismissReasonSheetOpen, setIsDismissReasonSheetOpen] = useState(false); const { - data: profile, - isLoading, + data: queriedProfile, + isLoading: isQueryLoading, refetch: refetchProfile, - } = useMarriageProfileQuery(); + } = useMarriageProfileQuery({ + enabled: !profileProp, + }); + + const profile = profileProp ?? queriedProfile; + const isLoading = !profileProp && isQueryLoading; useEffect(() => { if (!profile) { diff --git a/src/app/request-accepted/request-accepted-client.tsx b/src/app/request-accepted/request-accepted-client.tsx index 34cb124..a6fe12c 100644 --- a/src/app/request-accepted/request-accepted-client.tsx +++ b/src/app/request-accepted/request-accepted-client.tsx @@ -245,9 +245,7 @@ export default function RequestAcceptedClient() { useState(false); const [showPaymentSuccessToast, setShowPaymentSuccessToast] = useState(false); const profileHref = localizePath("/new-match/profile", locale); - const { data: profile, isLoading } = useMarriageProfileQuery({ - refetchInterval: 3000, - }); + const { data: profile, isLoading } = useMarriageProfileQuery(); const isFemaleProfile = profile?.gender === "female"; const contactSharedAtStr = profile?.active_case?.contact_shared_at; @@ -839,6 +837,7 @@ export default function RequestAcceptedClient() { diff --git a/src/app/request-sent/request-sent-client.tsx b/src/app/request-sent/request-sent-client.tsx index bebdbf2..f6be4c2 100644 --- a/src/app/request-sent/request-sent-client.tsx +++ b/src/app/request-sent/request-sent-client.tsx @@ -171,6 +171,7 @@ export default function RequestSentClient() { diff --git a/src/components/Componentes/match-profile-overlay.tsx b/src/components/Componentes/match-profile-overlay.tsx index f39d578..ba243a2 100644 --- a/src/components/Componentes/match-profile-overlay.tsx +++ b/src/components/Componentes/match-profile-overlay.tsx @@ -4,10 +4,12 @@ import { useCallback, useEffect, useState } from "react"; import NewMatchProfilePage from "@/app/new-match/profile/page"; import SectionOverlayHost from "@/components/Componentes/section-overlay-host"; import { useHardwareBackHandler } from "@/hooks/use-hardware-back-handler"; +import type { MarriageProfile } from "@/hooks/marriage/types"; export type MatchProfileOverlayProps = { open: boolean; onClose: () => void; + profile?: MarriageProfile; }; /** @@ -66,10 +68,11 @@ export function useMatchProfileOverlay() { export function MatchProfileOverlay({ open, onClose, + profile, }: MatchProfileOverlayProps) { return ( - + ); } diff --git a/src/hooks/marriage/use-profile-main.ts b/src/hooks/marriage/use-profile-main.ts index 3151832..7196011 100644 --- a/src/hooks/marriage/use-profile-main.ts +++ b/src/hooks/marriage/use-profile-main.ts @@ -45,7 +45,7 @@ export function useMarriageProfileQuery( options?: QueryOptions, ) { const query = useQuery({ - staleTime: 10 * 1000, + staleTime: 5 * 60 * 1000, refetchOnWindowFocus: false, ...options, queryFn: getMarriageProfile,