refactor(FilterManager): replace API call with listCommunities utility for community data retrieval
Publish Docker image / build-and-push (push) Successful in 2m7s

- Updated the community data fetching logic in FilterManager to utilize the listCommunities function, improving code clarity and maintainability.
- Ensured proper handling of aborted requests to prevent unnecessary state updates.

Made-with: Cursor
This commit is contained in:
2026-04-08 00:24:42 +07:00
parent e99700a916
commit 6473ff8bbd
+5 -3
View File
@@ -47,6 +47,7 @@ import {
import { CSS } from '@dnd-kit/utilities';
import { normalizeGateways, countryToFlag } from './utils/serverUtils.js';
import { usePing } from './contexts/PingContext.jsx';
import { listCommunities } from './lib/evobgpData.js';
// Компонент автокомплита для выбора Community
function CommunityAutocomplete({ label, value, onChange, communities = [], required = false, placeholder = 'Введите или выберите community...', baseAS = '65001' }) {
@@ -911,10 +912,11 @@ function FilterManager() {
(async () => {
try {
const res = await api.get(`/communities`, opts);
setCommunities(Array.isArray(res.data) ? res.data : []);
const rows = await listCommunities();
if (signal.aborted) return;
setCommunities(Array.isArray(rows) ? rows : []);
} catch (e) {
if (e?.name === 'CanceledError' || e?.name === 'AbortError' || e?.code === 'ERR_CANCELED') return;
if (signal.aborted) return;
}
})();