优化任务列表性能和本地登录代理

This commit is contained in:
yml2213
2026-08-05 10:03:18 +08:00
parent dff0d7db9e
commit 2fda47c631
13 changed files with 252 additions and 29 deletions
+5
View File
@@ -316,6 +316,7 @@ export default function HuyaTasksPage() {
const notifiedPaidTaskIds = useRef<Set<number>>(new Set());
const accountTableAreaRef = useRef<HTMLDivElement | null>(null);
const [accountTableAreaHeight, setAccountTableAreaHeight] = useState(460);
const tasksLoadingRef = useRef(false);
const { logs, connected: wsConnected, connect: connectLogs } = useWebSocketLogs();
const { can } = usePermissions();
@@ -455,6 +456,8 @@ export default function HuyaTasksPage() {
}, [canConfig, form, rememberExistingPaymentQrcodes, rememberExistingQrcodes]);
const loadTasks = useCallback(async () => {
if (tasksLoadingRef.current) return;
tasksLoadingRef.current = true;
try {
const data = await huyaApi.listTasks();
const nextTasks = mergeTaskImageCache(data, qrImageCacheRef.current);
@@ -466,6 +469,8 @@ export default function HuyaTasksPage() {
}
} catch {
// 轮询失败不打扰操作,下一轮继续刷新。
} finally {
tasksLoadingRef.current = false;
}
}, [rememberExistingPaymentQrcodes, rememberExistingQrcodes]);