From 836bfe7f365ad264c710fd4ef789670e9178c863 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 22 Dec 2025 01:59:58 -0800 Subject: [PATCH] =?UTF-8?q?fix(mobile-app):=20=E4=BF=AE=E5=A4=8D=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=90=8E"=E5=AE=A1=E6=A0=B8=E4=B8=AD"=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=8D=E6=9B=B4=E6=96=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题:用户手机号注册成功后,"我的"页面仍显示"创建账号审核中..." 原因: - set_password_page 注册成功后直接跳转,没有刷新 AuthProvider 状态 - ProfilePage.dispose() 中使用 ref.read() 导致 widget disposed 后报错 修复: 1. set_password_page: 跳转前调用 loadAuthState() 刷新状态 2. profile_page: dispose() 中用 try-catch 包裹 ref.read() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .claude/settings.local.json | 5 ++++- .../auth/presentation/pages/set_password_page.dart | 6 ++++++ .../profile/presentation/pages/profile_page.dart | 9 +++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 962bca2e..fa7a7c5f 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -281,7 +281,10 @@ "Bash(flutter run:*)", "Bash(flutter devices:*)", "Bash(npx qrcode:*)", - "Bash(node -e \"\nconst { ethers } = require\\(''ethers''\\);\n\nconst KAVA_TESTNET_RPC = ''https://evm.testnet.kava.io'';\nconst privateKey = ''0xd42a6e6021ebd884f3f179d3793a32e97b9f1001db6ff44441ec455d748b9aa6'';\nconst USDT_CONTRACT = ''0xc12f6A4A7Fd0965085B044A67a39CcA2ff7fe0dF'';\nconst TO_ADDRESS = ''0xbfade3806321b7caa958fbc5f6c23d1b88861611'';\n\nasync function transfer\\(\\) {\n const provider = new ethers.JsonRpcProvider\\(KAVA_TESTNET_RPC\\);\n const wallet = new ethers.Wallet\\(privateKey, provider\\);\n \n const abi = [''function transfer\\(address to, uint256 amount\\) returns \\(bool\\)'', ''function balanceOf\\(address\\) view returns \\(uint256\\)''];\n const contract = new ethers.Contract\\(USDT_CONTRACT, abi, wallet\\);\n \n const amount = BigInt\\(1000000\\) * BigInt\\(1000000\\);\n \n console.log\\(''Transferring 1,000,000 USDT to'', TO_ADDRESS\\);\n const tx = await contract.transfer\\(TO_ADDRESS, amount, { gasLimit: 100000 }\\);\n console.log\\(''TX Hash:'', tx.hash\\);\n await tx.wait\\(\\);\n \n const newBalance = await contract.balanceOf\\(TO_ADDRESS\\);\n console.log\\(''New balance:'', Number\\(newBalance\\) / 1e6, ''USDT''\\);\n}\n\ntransfer\\(\\).catch\\(e => console.error\\(''Error:'', e.message\\)\\);\n\")" + "Bash(node -e \"\nconst { ethers } = require\\(''ethers''\\);\n\nconst KAVA_TESTNET_RPC = ''https://evm.testnet.kava.io'';\nconst privateKey = ''0xd42a6e6021ebd884f3f179d3793a32e97b9f1001db6ff44441ec455d748b9aa6'';\nconst USDT_CONTRACT = ''0xc12f6A4A7Fd0965085B044A67a39CcA2ff7fe0dF'';\nconst TO_ADDRESS = ''0xbfade3806321b7caa958fbc5f6c23d1b88861611'';\n\nasync function transfer\\(\\) {\n const provider = new ethers.JsonRpcProvider\\(KAVA_TESTNET_RPC\\);\n const wallet = new ethers.Wallet\\(privateKey, provider\\);\n \n const abi = [''function transfer\\(address to, uint256 amount\\) returns \\(bool\\)'', ''function balanceOf\\(address\\) view returns \\(uint256\\)''];\n const contract = new ethers.Contract\\(USDT_CONTRACT, abi, wallet\\);\n \n const amount = BigInt\\(1000000\\) * BigInt\\(1000000\\);\n \n console.log\\(''Transferring 1,000,000 USDT to'', TO_ADDRESS\\);\n const tx = await contract.transfer\\(TO_ADDRESS, amount, { gasLimit: 100000 }\\);\n console.log\\(''TX Hash:'', tx.hash\\);\n await tx.wait\\(\\);\n \n const newBalance = await contract.balanceOf\\(TO_ADDRESS\\);\n console.log\\(''New balance:'', Number\\(newBalance\\) / 1e6, ''USDT''\\);\n}\n\ntransfer\\(\\).catch\\(e => console.error\\(''Error:'', e.message\\)\\);\n\")", + "Bash(git commit -m \"$\\(cat <<''EOF''\nfeat\\(admin-service\\): 添加 seed 脚本同步系统账户到 user_query_view\n\n问题:admin-web 用户管理页面无数据,因为 user_query_view 表是空的\n原因:identity-service 的 seed 创建的系统账户不会触发 Kafka 事件\n\n解决方案:\n- 创建 admin-service 的 seed.ts,直接同步系统账户到 user_query_view\n- 配置 package.json 的 prisma.seed\n\n运行方式:\ncd backend/services/admin-service && npx prisma db seed\n\n🤖 Generated with [Claude Code]\\(https://claude.com/claude-code\\)\n\nCo-Authored-By: Claude Sonnet 4.5 \nEOF\n\\)\")", + "Bash(git commit -m \"$\\(cat <<''EOF''\nfix\\(admin-service\\): 修复 Kafka topic 订阅不匹配问题\n\n问题:admin-web 用户管理页面无数据\n原因:admin-service 订阅的是 ''identity.events'',\n 但 identity-service 发送到的是具体的 topic 如 ''identity.UserAccountCreated''\n\n修复:将订阅的 topics 改为与 identity-service 的 IDENTITY_TOPICS 一致:\n- identity.UserAccountCreated\n- identity.UserAccountAutoCreated\n- identity.PhoneBound\n- identity.KYCSubmitted\n- identity.KYCVerified\n- identity.KYCRejected\n- identity.UserAccountFrozen\n- identity.UserAccountDeactivated\n\n🤖 Generated with [Claude Code]\\(https://claude.com/claude-code\\)\n\nCo-Authored-By: Claude Sonnet 4.5 \nEOF\n\\)\")", + "Bash(node -e \"\nconst { ethers } = require\\(''ethers''\\);\n\nconst KAVA_TESTNET_RPC = ''https://evm.testnet.kava.io'';\nconst privateKey = ''0xd42a6e6021ebd884f3f179d3793a32e97b9f1001db6ff44441ec455d748b9aa6'';\nconst USDT_CONTRACT = ''0xc12f6A4A7Fd0965085B044A67a39CcA2ff7fe0dF'';\nconst TO_ADDRESS = ''0x5b25ae3ac4ad6291ef67aceaf657b62a200d8bf8'';\n\nasync function transfer\\(\\) {\n const provider = new ethers.JsonRpcProvider\\(KAVA_TESTNET_RPC\\);\n const wallet = new ethers.Wallet\\(privateKey, provider\\);\n \n const abi = [''function transfer\\(address to, uint256 amount\\) returns \\(bool\\)'', ''function balanceOf\\(address\\) view returns \\(uint256\\)''];\n const contract = new ethers.Contract\\(USDT_CONTRACT, abi, wallet\\);\n \n const amount = BigInt\\(1000000\\) * BigInt\\(1000000\\);\n \n console.log\\(''Transferring 1,000,000 USDT to'', TO_ADDRESS\\);\n const tx = await contract.transfer\\(TO_ADDRESS, amount, { gasLimit: 100000 }\\);\n console.log\\(''TX Hash:'', tx.hash\\);\n await tx.wait\\(\\);\n \n const newBalance = await contract.balanceOf\\(TO_ADDRESS\\);\n console.log\\(''New balance:'', Number\\(newBalance\\) / 1e6, ''USDT''\\);\n}\n\ntransfer\\(\\).catch\\(e => console.error\\(''Error:'', e.message\\)\\);\n\")" ], "deny": [], "ask": [] diff --git a/frontend/mobile-app/lib/features/auth/presentation/pages/set_password_page.dart b/frontend/mobile-app/lib/features/auth/presentation/pages/set_password_page.dart index 11c775ab..a2a74b99 100644 --- a/frontend/mobile-app/lib/features/auth/presentation/pages/set_password_page.dart +++ b/frontend/mobile-app/lib/features/auth/presentation/pages/set_password_page.dart @@ -145,6 +145,12 @@ class _SetPasswordPageState extends ConsumerState { if (!mounted) return; + // 刷新 AuthProvider 状态(读取新保存的 isAccountCreated) + await ref.read(authProvider.notifier).loadAuthState(); + debugPrint('[SetPasswordPage] AuthProvider 状态已刷新'); + + if (!mounted) return; + // 跳转到主页 context.go(RoutePaths.mining); } catch (e) { diff --git a/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart b/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart index 7cce924a..a7bcd72a 100644 --- a/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart +++ b/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart @@ -853,8 +853,13 @@ class _ProfilePageState extends ConsumerState { _referralDebounceTimer?.cancel(); _authorizationDebounceTimer?.cancel(); _walletDebounceTimer?.cancel(); - // 停止钱包轮询 - ref.read(walletStatusProvider.notifier).stopPolling(); + // 停止钱包轮询(在 super.dispose() 之前安全调用) + try { + ref.read(walletStatusProvider.notifier).stopPolling(); + } catch (e) { + // 忽略 dispose 后的 ref 访问错误 + debugPrint('[ProfilePage] dispose() - 停止轮询时出错(可忽略): $e'); + } super.dispose(); }