feat(personal): 持久化开发者模式状态并优化登录后数据加载
- 新增 kv-store 持久化开发者模式开关,避免每次冷启动丢失 - 登录成功后立即拉取用户资料,减少首页空数据闪烁 - 修复体重卡片在未登录时重复请求的问题 - 移除 ActivityHeatMap 与 userSlice 中的调试日志 - useAuthGuard 增加 token 调试输出(临时)
This commit is contained in:
@@ -100,8 +100,6 @@ const ActivityHeatMap = () => {
|
||||
return weeks;
|
||||
}, [generateActivityData, weeksToShow]);
|
||||
|
||||
console.log('organizeDataByWeeks', organizeDataByWeeks);
|
||||
|
||||
|
||||
// 获取月份标签(简化的月份标签系统)
|
||||
const getMonthLabels = useMemo(() => {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user