chore: clean up migration comments and unused params

Remove obsolete Dart migration notes and route handling comments from splash-button.tsx and auth-machine.ts, and drop the unused `self` parameter from `chatWebSocketActor` callback signature.
This commit is contained in:
2026-06-16 12:01:42 +08:00
parent 29776272ad
commit cba52884a3
3 changed files with 2 additions and 17 deletions
@@ -2,16 +2,11 @@
/** /**
* Splash 底部按钮组 * Splash 底部按钮组
* *
* 原始 Dart: lib/ui/splash/widgets/splash_button.dart
* `Row(children: [Skip 文本, SizedBox 26, 社交登录按钮])`
*
* 本组件是 splash 鉴权流程的**纯 UI 入口** * 本组件是 splash 鉴权流程的**纯 UI 入口**
* - 消费 `useAuthState` / `useAuthDispatch`(仅用于 isLoading 显示 + 派事件) * - 消费 `useAuthState` / `useAuthDispatch`(仅用于 isLoading 显示 + 派事件)
* - **Skip 按钮 = 显式游客登录入口**(派发 `AuthGuestLoginSubmitted` * - **Skip 按钮 = 显式游客登录入口**(派发 `AuthGuestLoginSubmitted`
* - 社交登录按钮仅派发 `AuthFacebookLoginSubmitted` 事件,由状态机负责调 NextAuth * - 社交登录按钮仅派发 `AuthFacebookLoginSubmitted` 事件,由状态机负责调 NextAuth
* *
* **不**做路由跳转 —— 路由逻辑**全部**移到 splash-screen.tsx 统一管理。
*
* **派事件策略**(**单**事件): * **派事件策略**(**单**事件):
* - 派业务事件(`AuthGuestLoginSubmitted` / `AuthFacebookLoginSubmitted`)→ 状态机开始跑 * - 派业务事件(`AuthGuestLoginSubmitted` / `AuthFacebookLoginSubmitted`)→ 状态机开始跑
* - `pendingRedirect: true` 在**登录成功 onDone** 里**自动**置(auth-machine.ts `onLoginSuccess` helper * - `pendingRedirect: true` 在**登录成功 onDone** 里**自动**置(auth-machine.ts `onLoginSuccess` helper
+1 -11
View File
@@ -1,14 +1,5 @@
/** /**
* Auth 状态机(XState v5 * Auth 状态机(XState v5
*
* 原始 Dart: lib/ui/auth/bloc/auth_bloc.dart + auth_state.dart + auth_event.dart
*
* 本轮迁移:所有认证登录调用(含 OAuth 社交登录)统一收口到状态机内。
* 业务层只派发事件(`AuthEmailLoginSubmitted` / `AuthGoogleLoginSubmitted` / 等),
* 状态机通过 actors 调 `authRepository`(邮箱 / OAuth token sync)或
* `next-auth/react.signIn`OAuth 跳转)。
*
* 异步服务(actors)已抽到 `./auth-actors`,小工具抽到 `./auth-helpers`。
*/ */
import { setup, assign } from "xstate"; import { setup, assign } from "xstate";
@@ -35,8 +26,6 @@ export type { AuthEvent } from "./auth-events";
// Machine // Machine
// //
// 设计:所有登录/同步流跑完都回 `idle`(带正确 `loginStatus`)。 // 设计:所有登录/同步流跑完都回 `idle`(带正确 `loginStatus`)。
// **不**再设 `success` state —— 之前曾用 "success" 当"刚成功"信号,
// 但 status check 流也会误入 success,触发 splash-button 误跳 /chat。
// //
// `pendingRedirect: boolean`"用户**显式**触发了登录"信号)—— // `pendingRedirect: boolean`"用户**显式**触发了登录"信号)——
// **在登录成功的 onDone 里自动置 true** // **在登录成功的 onDone 里自动置 true**
@@ -100,6 +89,7 @@ export const authMachine = setup({
AuthEmailRegisterSubmitted: "loadingEmailRegister", AuthEmailRegisterSubmitted: "loadingEmailRegister",
AuthGoogleLoginSubmitted: "loadingOAuth", AuthGoogleLoginSubmitted: "loadingOAuth",
AuthFacebookLoginSubmitted: "loadingOAuth", AuthFacebookLoginSubmitted: "loadingOAuth",
// OAuth 回调后 sync 入口 —— 由 <OAuthSessionSync /> 派发 // OAuth 回调后 sync 入口 —— 由 <OAuthSessionSync /> 派发
AuthGoogleSyncSubmitted: "syncingGoogleBackend", AuthGoogleSyncSubmitted: "syncingGoogleBackend",
AuthFacebookSyncSubmitted: "syncingFacebookBackend", AuthFacebookSyncSubmitted: "syncingFacebookBackend",
+1 -1
View File
@@ -184,7 +184,7 @@ export const loadMoreHistoryActor = fromPromise<
* - cleanup 函数 → XState 在 parent state exit 时自动调用 * - cleanup 函数 → XState 在 parent state exit 时自动调用
*/ */
export const chatWebSocketActor = fromCallback<ChatEvent, { token: string }>( export const chatWebSocketActor = fromCallback<ChatEvent, { token: string }>(
({ sendBack, input, self }) => { ({ sendBack, input }) => {
console.log("[chat-machine] chatWebSocketActor ENTRY", { console.log("[chat-machine] chatWebSocketActor ENTRY", {
hasToken: !!input.token, hasToken: !!input.token,
tokenLength: input.token?.length ?? 0, tokenLength: input.token?.length ?? 0,