diff --git a/src/app/[lang]/page.tsx b/src/app/[lang]/page.tsx
index 5898dff..a0099b7 100644
--- a/src/app/[lang]/page.tsx
+++ b/src/app/[lang]/page.tsx
@@ -7,6 +7,10 @@ import {
isAuthenticatedToken,
MARRIAGE_ENTRY_PATH_COOKIE,
} from "@/lib/entry-route-cache";
+import {
+ getSubmitPath,
+ hasCompletedMarriageProfileBasics,
+} from "@/lib/get-submit-path";
import { localizePath } from "@/translations/config";
export const dynamic = "force-dynamic";
@@ -30,10 +34,41 @@ export default async function LocaleEntryPage({
redirect(localizePath(cachedEntryPath, lang));
}
+ // 1. If not authenticated, render instantly on the server (0ms client delay)
+ if (!hasToken) {
+ return ;
+ }
+
+ // 2. If authenticated without cached route, resolve target route directly on the server
+ let targetPath: string | null = null;
+ const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
+ if (apiBaseUrl) {
+ try {
+ const res = await fetch(`${apiBaseUrl}/api/marriage/profile/main/`, {
+ headers: {
+ Authorization: `Token ${token}`,
+ Accept: "application/json",
+ },
+ cache: "no-store",
+ });
+ if (res.ok) {
+ const profile = await res.json();
+ targetPath = hasCompletedMarriageProfileBasics(profile)
+ ? getSubmitPath(profile)
+ : "/intro";
+ }
+ } catch {
+ // Graceful fallback to client-side resolver if server fetch fails
+ }
+ }
+
+ if (targetPath) {
+ redirect(localizePath(targetPath, lang));
+ }
+
return (
<>
- {!hasToken ? : null}
-
+
>
);
}