diff --git a/src/app/finding-match/finding-match-client.tsx b/src/app/finding-match/finding-match-client.tsx index 2d7b85f..4b44acb 100644 --- a/src/app/finding-match/finding-match-client.tsx +++ b/src/app/finding-match/finding-match-client.tsx @@ -47,11 +47,20 @@ export default function FindingMatchClient() { }); useEffect(() => { + console.log("🔍 [FindingMatchClient] State Evaluation:", { + hasProfile: Boolean(profile), + isFetched, + status: profile?.status, + active_case: profile?.active_case, + calculatedPath: profile ? getSubmitPath(profile) : null, + }); if (!profile || !isFetched) { + console.log("⏳ [FindingMatchClient] Skipping redirect because !profile or !isFetched (isFetched=", isFetched, ")"); return; } const targetPath = getSubmitPath(profile); if (targetPath !== "/finding-match") { + console.log("🚀 [FindingMatchClient] Redirecting to:", targetPath); router.replace(localizePath(targetPath, locale)); } }, [profile, isFetched, locale, router]); diff --git a/src/app/new-match/new-match-client.tsx b/src/app/new-match/new-match-client.tsx index 4db945e..dc11c76 100644 --- a/src/app/new-match/new-match-client.tsx +++ b/src/app/new-match/new-match-client.tsx @@ -598,10 +598,12 @@ export default function NewMatchClient() { }); if (!profile || !isFetched) { + console.log("⏳ [NewMatchClient] Skipping redirect because !profile or !isFetched (isFetched=", isFetched, ")"); return; } const targetPath = getSubmitPath(profile); if (targetPath !== "/new-match") { + console.log("🚀 [NewMatchClient] Redirecting to:", targetPath); router.replace(localizePath(targetPath, locale)); } }, [profile, locale, router, isFetched]); diff --git a/src/hooks/marriage/use-profile-main.ts b/src/hooks/marriage/use-profile-main.ts index abf433b..0c5725c 100644 --- a/src/hooks/marriage/use-profile-main.ts +++ b/src/hooks/marriage/use-profile-main.ts @@ -75,8 +75,13 @@ export function useMarriageProfileQuery( const handleInitialData = (e: Event) => { const customEvent = e as CustomEvent; const initial = getInitialMarriageProfile(); + console.log("📥 [Profile Query] Received habib:marriage-initial-data event:", { + detail: customEvent.detail, + parsedInitial: initial, + }); if (initial) { queryClient.setQueryData(marriageQueryKeys.profile(), (old: any) => { + console.log("🔄 [Profile Query] Merging initialData into QueryCache. Old:", old, "New Initial:", initial); if (!old) return initial; return { ...initial,