mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-06-16 21:03:58 +08:00
perf(quota): drop discarded config.yaml prefetch
The quota page fetched /config.yaml on mount and on every header refresh but ignored the response; quota sections never consume it. Remove the fetch to save a request per visit.
This commit is contained in:
+3
-17
@@ -6,7 +6,7 @@ import { useCallback, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useHeaderRefresh } from '@/hooks/useHeaderRefresh';
|
||||
import { useAuthStore } from '@/stores';
|
||||
import { authFilesApi, configFileApi } from '@/services/api';
|
||||
import { authFilesApi } from '@/services/api';
|
||||
import {
|
||||
QuotaSection,
|
||||
ANTIGRAVITY_CONFIG,
|
||||
@@ -29,15 +29,6 @@ export function QuotaPage() {
|
||||
|
||||
const disableControls = connectionStatus !== 'connected';
|
||||
|
||||
const loadConfig = useCallback(async () => {
|
||||
try {
|
||||
await configFileApi.fetchConfigYaml();
|
||||
} catch (err: unknown) {
|
||||
const errorMessage = err instanceof Error ? err.message : t('notification.refresh_failed');
|
||||
setError((prev) => prev || errorMessage);
|
||||
}
|
||||
}, [t]);
|
||||
|
||||
const loadFiles = useCallback(async () => {
|
||||
setLoading(true);
|
||||
setError('');
|
||||
@@ -52,16 +43,11 @@ export function QuotaPage() {
|
||||
}
|
||||
}, [t]);
|
||||
|
||||
const handleHeaderRefresh = useCallback(async () => {
|
||||
await Promise.all([loadConfig(), loadFiles()]);
|
||||
}, [loadConfig, loadFiles]);
|
||||
|
||||
useHeaderRefresh(handleHeaderRefresh);
|
||||
useHeaderRefresh(loadFiles);
|
||||
|
||||
useEffect(() => {
|
||||
loadFiles();
|
||||
loadConfig();
|
||||
}, [loadFiles, loadConfig]);
|
||||
}, [loadFiles]);
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
|
||||
Reference in New Issue
Block a user