fix(usercenter): 删冗余 Preferences 卡片 + 修登录态进用户中心闪登录页
1. Settings 页删掉 Preferences 卡片(语言/主题切换)——顶栏已有语言下拉 + 主题 切换按钮,重复。连带删只被它用的 Preferences/Row/Seg 函数 + useUI 导入。 2. 修 bug:从官网登录态点"用户中心"进 /user/ 会先闪登录页再跳面板。根因:渲染 守卫在 !ready(会话续期中)时也直接渲染 Login。改为:本地有 refresh token 且 续期未完成时显示加载态(非登录页),续期成功→面板、失败/无 token→登录页。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -120,8 +120,16 @@ export default function UserCenter() {
|
||||
setView('overview');
|
||||
}
|
||||
|
||||
// 静态导出无服务端会话:首屏(!ready)与未登录一律直接渲染登录页,避免出现空白
|
||||
// 背景(慢网络下用户会看到"空的")。已登录用户(有 refresh)会话续期完成后再切面板。
|
||||
// 已登录(本地有 refresh token)但会话续期尚未完成:显示加载态而非登录页,
|
||||
// 避免"先闪登录页再跳面板"(从官网带登录态进来时的 bug)。续期成功→面板、失败→登录页。
|
||||
if (!ready && hasRefresh()) {
|
||||
return (
|
||||
<div style={{ minHeight: '70vh', display: 'flex', alignItems: 'center', justifyContent: 'center', color: 'var(--fg3)', fontSize: 14 }}>
|
||||
{t('loading')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
// 无 refresh token(未登录)或续期失败:渲染登录页。
|
||||
if (!ready || !authed) {
|
||||
return <Login onDone={onLoginDone} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user