refactor(ResourceStatsPage, TrafficDashboard): update button click handlers to use arrow functions for consistency and improve error handling by retaining previous data on fetch failure
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m11s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m11s
This commit is contained in:
@@ -157,7 +157,7 @@ export default function ResourceStatsPage() {
|
||||
} catch (e) {
|
||||
if (e?.name === 'CanceledError' || e?.name === 'AbortError' || e?.code === 'ERR_CANCELED') return;
|
||||
setError(e?.response?.data?.message || e?.message || 'Не удалось загрузить статистику');
|
||||
setRouters([]);
|
||||
// Не очищаем список — пользователь видит старые данные и сообщение об ошибке
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ export default function ResourceStatsPage() {
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-outline-primary"
|
||||
onClick={fetchStats}
|
||||
onClick={() => fetchStats()}
|
||||
disabled={loading}
|
||||
>
|
||||
<IconRefresh size={18} className={loading ? 'spin' : ''} />
|
||||
|
||||
@@ -274,7 +274,7 @@ export default function TrafficDashboard() {
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-outline-primary"
|
||||
onClick={fetchStats}
|
||||
onClick={() => fetchStats()}
|
||||
disabled={loading}
|
||||
>
|
||||
<IconRefresh className={loading ? 'spin me-2' : 'me-2'} size={18} />
|
||||
|
||||
Reference in New Issue
Block a user