feat(personal): 持久化开发者模式状态并优化登录后数据加载

- 新增 kv-store 持久化开发者模式开关,避免每次冷启动丢失
- 登录成功后立即拉取用户资料,减少首页空数据闪烁
- 修复体重卡片在未登录时重复请求的问题
- 移除 ActivityHeatMap 与 userSlice 中的调试日志
- useAuthGuard 增加 token 调试输出(临时)
This commit is contained in:
richarjiang
2025-09-15 16:24:38 +08:00
parent 2357596665
commit 281149201b
7 changed files with 40 additions and 11 deletions

View File

@@ -34,7 +34,7 @@ export function WeightHistoryCard() {
const [showBMIModal, setShowBMIModal] = useState(false);
const { pushIfAuthedElseLogin } = useAuthGuard();
const { pushIfAuthedElseLogin, isLoggedIn } = useAuthGuard();
const colorScheme = useColorScheme();
const themeColors = Colors[colorScheme ?? 'light'];
@@ -42,14 +42,12 @@ export function WeightHistoryCard() {
useEffect(() => {
if (hasWeight) {
loadWeightHistory();
}
}, [userProfile?.weight]);
loadWeightHistory();
}, [userProfile?.weight, isLoggedIn]);
const loadWeightHistory = async () => {
try {
await dispatch(fetchWeightHistory() as any);
await dispatch(fetchWeightHistory() as any).unwrap();
} catch (error) {
console.error('加载体重历史失败:', error);
}