fix(mp): 患者端卡死深度审查修复 — CRITICAL 回归 + 并发保护 + 页栈溢出防护

CRITICAL:
- 咨询详情页 loadData 引用已删除的 pollingRef → 移除残余引用

HIGH:
- 401 重试递归改循环结构,避免并发限制器双 slot 占用
- 医生端 4 个列表页添加 loadingRef 防重入(consultation/alerts/dialysis/prescription)
- 新增 safeNavigateTo 页栈溢出保护(栈≥9 自动 redirectTo)

前期修复一并提交:
- 全局并发限制 MAX_CONCURRENT=8
- doRefresh 失败时完整清理 Storage + 重置缓存状态
- 401 跳转登录页修正
- 长轮询 generation counter 模式
- 首页/健康页 loadingRef + refreshToday 去重
This commit is contained in:
iven
2026-05-15 00:30:59 +08:00
parent 5ea991c5df
commit 74bffb4878
13 changed files with 245 additions and 93 deletions

View File

@@ -1,5 +1,5 @@
import { View, Text, Swiper, SwiperItem, Image } from '@tarojs/components';
import { useState, useMemo } from 'react';
import { useState, useMemo, useRef } from 'react';
import Taro, { usePullDownRefresh, useDidShow, useDidHide } from '@tarojs/taro';
import { useAuthStore } from '../../stores/auth';
import { useUIStore } from '../../stores/ui';
@@ -190,6 +190,7 @@ function HomeDashboard({ modeClass }: { modeClass: string }) {
const [reminders, setReminders] = useState<ReminderItem[]>([]);
const [unreadCount, setUnreadCount] = useState(0);
const [remindersLoading, setRemindersLoading] = useState(false);
const remindersLoadingRef = useRef(false);
const { trigger: triggerHomeRefresh } = useThrottledDidShow(() => {
refreshToday();
@@ -216,7 +217,8 @@ function HomeDashboard({ modeClass }: { modeClass: string }) {
const loadReminders = async () => {
const patientId = useAuthStore.getState().currentPatient?.id;
if (!patientId) return;
if (!patientId || remindersLoadingRef.current) return;
remindersLoadingRef.current = true;
setRemindersLoading(true);
try {
const items: ReminderItem[] = [];
@@ -257,6 +259,7 @@ function HomeDashboard({ modeClass }: { modeClass: string }) {
} catch {
setReminders([]);
} finally {
remindersLoadingRef.current = false;
setRemindersLoading(false);
}
};