rwadurian/frontend
hailin 8bafb0a8d4 fix(mobile-app): 增加切换账号全局防护,彻底解决切换期间自动退出登录
根因:切换账号时 saveCurrentAccountData() 耗时 ~7 秒,期间定时器仍在发 API 请求,
clear 阶段 token 被删除后 in-flight 请求收到 401 → 触发 tokenExpired →
logoutCurrentAccount() 把刚恢复的新账号数据全部擦除。

修复(两层防护):
1. 全局锁 isSwitchingAccount:MultiAccountService 在 switchToAccount 整个过程中
   设为 true,app.dart _handleTokenExpired 检测到该标志直接 return,不执行 logout
2. 定时器提前停止:将定时器停止从 onBeforeRestore(save 之后)移到 switchToAccount
   调用之前,确保 save 期间无新 API 请求
3. try/finally 保证标志位必定清除,异常情况不会锁死后续 tokenExpired 事件

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 12:41:45 -08:00
..
.claude refactor(mpc-system): migrate to party-driven architecture with PartyID-based routing 2025-12-05 08:11:28 -08:00
admin-web fix(pricing): 手动调价支持负数降价对冲 2026-02-26 11:58:11 -08:00
mining-admin-web fix(frontend): snapshot.types 补充 MPC_POSTGRES 类型和标签 2026-02-24 04:19:57 -08:00
mining-app fix(mining-app): 全网兑换销毁量改为保留8位小数 2026-02-26 09:54:53 -08:00
mobile-app fix(mobile-app): 增加切换账号全局防护,彻底解决切换期间自动退出登录 2026-02-26 12:41:45 -08:00
mobile-upgrade fix(mobile-upgrade): 股行App版本管理API地址改为 mapi.szaiai.com 2026-02-04 19:04:56 -08:00
temp_backup refactor(mpc-system): migrate to party-driven architecture with PartyID-based routing 2025-12-05 08:11:28 -08:00
README.MD . 2025-11-25 10:17:37 +08:00

README.MD