|
|
|
@ -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]); |
|
|
|
|