diff --git a/src/app/auth/auth-screen.tsx b/src/app/auth/auth-screen.tsx
index 2bdd0f2a..63d31746 100644
--- a/src/app/auth/auth-screen.tsx
+++ b/src/app/auth/auth-screen.tsx
@@ -4,7 +4,7 @@
*
* 原始 Dart: lib/ui/auth/auth_screen.dart
*/
-import { useEffect } from "react";
+import { useEffect, useSyncExternalStore } from "react";
import { useRouter } from "next/navigation";
import { MobileShell } from "@/app/_components/core";
@@ -17,14 +17,15 @@ import { Logger } from "@/utils";
const log = new Logger("AppAuthAuthScreen");
-export interface AuthScreenProps {
- redirectTo?: string | null;
-}
-
-export function AuthScreen({ redirectTo = null }: AuthScreenProps) {
+export function AuthScreen() {
const state = useAuthState();
const authDispatch = useAuthDispatch();
const router = useRouter();
+ const redirectTo = useSyncExternalStore(
+ subscribeLocationSnapshot,
+ readRedirectFromLocation,
+ () => null,
+ );
const safeRedirectTo = getSafeRedirectPath(redirectTo) ?? ROUTES.chat;
// 邮箱登录成功 → 跳转;User hydrate 由根级 监听 loginStatus 变化处理。
@@ -70,3 +71,12 @@ function getSafeRedirectPath(redirectTo: string | null | undefined): string | nu
if (!redirectTo.startsWith("/") || redirectTo.startsWith("//")) return null;
return redirectTo;
}
+
+function readRedirectFromLocation(): string | null {
+ if (typeof window === "undefined") return null;
+ return new URLSearchParams(window.location.search).get("redirect");
+}
+
+function subscribeLocationSnapshot(): () => void {
+ return () => {};
+}
diff --git a/src/app/auth/page.tsx b/src/app/auth/page.tsx
index d7f86b80..357c4f1d 100644
--- a/src/app/auth/page.tsx
+++ b/src/app/auth/page.tsx
@@ -1,16 +1,5 @@
import { AuthScreen } from "@/app/auth/auth-screen";
-interface AuthPageProps {
- searchParams: Promise<{
- redirect?: string | string[];
- }>;
-}
-
-export default async function AuthPage({ searchParams }: AuthPageProps) {
- const params = await searchParams;
- const redirectTo = Array.isArray(params.redirect)
- ? params.redirect[0]
- : params.redirect;
-
- return ;
+export default function AuthPage() {
+ return ;
}