根因:switchToAccount() 流程中,定时器在 _clearCurrentAccountData() 之后才停止。clear 阶段会删除 token,但此时定时器仍在运行, in-flight 的 API 请求收到 401 → 触发 _handleTokenExpired() → 调用 logoutCurrentAccount() 把正在恢复的新账号数据全部清掉 → 用户被自动踢到登录页面。 修复:将 onBeforeRestore 回调(停止定时器)移到 _clearCurrentAccountData() 之前执行,确保所有 API 请求停止后再清除 token。 修改前: save → clear(删token) → 停定时器 → restore 修改后: save → 停定时器 → clear(删token) → restore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| core | ||
| features | ||
| routes | ||
| app.dart | ||
| bootstrap.dart | ||
| main.dart | ||