diff --git a/frontend/src/ASNsNewManager.jsx b/frontend/src/ASNsNewManager.jsx index eba577c..b17aebf 100644 --- a/frontend/src/ASNsNewManager.jsx +++ b/frontend/src/ASNsNewManager.jsx @@ -40,6 +40,7 @@ function ASNsNewManager() { const [success, setSuccess] = useState(''); const [searchTerm, setSearchTerm] = useState(''); const searchTimer = useRef(null); + const didInit = useRef(false); const [editingAsn, setEditingAsn] = useState(null); const [editingValue, setEditingValue] = useState(''); const [loading, setLoading] = useState(false); @@ -95,7 +96,6 @@ function ASNsNewManager() { }; acquire(); const interval = setInterval(acquire, 60_000); - fetchItems(); // Load WS URL once (async () => { try { const r = await api.get('/ws/url'); setWsUrl(String(r.data?.url || '')); } catch {} @@ -131,10 +131,9 @@ function ASNsNewManager() { }; useEffect(() => { + if (!didInit.current) { didInit.current = true; fetchItems(); return; } if (searchTimer.current) clearTimeout(searchTimer.current); - searchTimer.current = setTimeout(() => { - fetchItems(); - }, 350); + searchTimer.current = setTimeout(() => { fetchItems(); }, 350); return () => { if (searchTimer.current) clearTimeout(searchTimer.current); }; // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentPage, searchTerm, filterCommunity]); diff --git a/frontend/src/DomainsNewManager.jsx b/frontend/src/DomainsNewManager.jsx index 4b971c9..fba01bf 100644 --- a/frontend/src/DomainsNewManager.jsx +++ b/frontend/src/DomainsNewManager.jsx @@ -40,6 +40,7 @@ function DomainsNewManager() { const [success, setSuccess] = useState(''); const [searchTerm, setSearchTerm] = useState(''); const searchTimer = useRef(null); + const didInit = useRef(false); const [editingDomain, setEditingDomain] = useState(null); const [editingValue, setEditingValue] = useState(''); const [loading, setLoading] = useState(false); @@ -100,7 +101,6 @@ function DomainsNewManager() { }; acquire(); const interval = setInterval(acquire, 60_000); - fetchItems(); (async () => { try { const r = await api.get('/ws/url'); setWsUrl(String(r.data?.url || '')); } catch {} })(); return () => { clearInterval(interval); @@ -133,10 +133,9 @@ function DomainsNewManager() { // Подгрузка при изменении страницы/поиска/фильтра useEffect(() => { + if (!didInit.current) { didInit.current = true; fetchItems(); return; } if (searchTimer.current) clearTimeout(searchTimer.current); - searchTimer.current = setTimeout(() => { - fetchItems(); - }, 350); + searchTimer.current = setTimeout(() => { fetchItems(); }, 350); return () => { if (searchTimer.current) clearTimeout(searchTimer.current); }; // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentPage, searchTerm, filterCommunity]); diff --git a/frontend/src/IPRangesManager.jsx b/frontend/src/IPRangesManager.jsx index 18595fb..c6690c8 100644 --- a/frontend/src/IPRangesManager.jsx +++ b/frontend/src/IPRangesManager.jsx @@ -40,6 +40,7 @@ function IPRangesManager() { const [success, setSuccess] = useState(''); const [searchTerm, setSearchTerm] = useState(''); const searchTimer = useRef(null); + const didInit = useRef(false); const [editingIp, setEditingIp] = useState(null); const [editingValue, setEditingValue] = useState(''); const [loading, setLoading] = useState(false); @@ -111,7 +112,6 @@ function IPRangesManager() { }; acquire(); const interval = setInterval(acquire, 60_000); - fetchItems(); (async () => { try { const r = await api.get('/ws/url'); setWsUrl(String(r.data?.url || '')); } catch {} })(); return () => { clearInterval(interval); @@ -143,10 +143,9 @@ function IPRangesManager() { }; useEffect(() => { + if (!didInit.current) { didInit.current = true; fetchItems(); return; } if (searchTimer.current) clearTimeout(searchTimer.current); - searchTimer.current = setTimeout(() => { - fetchItems(); - }, 350); + searchTimer.current = setTimeout(() => { fetchItems(); }, 350); return () => { if (searchTimer.current) clearTimeout(searchTimer.current); }; // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentPage, searchTerm, filterCommunity]);